Edgewall Software
Modify

Ticket #1829 (closed defect: fixed)

Opened 7 years ago

Last modified 5 years ago

ImageMacro may fail on WikiStart page

Reported by: Shun-ichi Goto <gotoh@…> Owned by: cboos
Priority: normal Milestone: 0.9
Component: wiki system Version: devel
Severity: normal Keywords:
Cc:
Release Notes:
API Changes:

Description

As same issue with #1802, ImageMacro? raises exception.
There's a workaround patch until formatter provides correct path info.
This patch also contains bug fix of split count to retrieve 'id' part correctly.

--- macros.py	(revision 2017)
+++ macros.py	(working copy)
@@ -314,7 +314,9 @@
             # FIXME: should be retrieved from the formatter...
             # ...and the formatter should be provided to the macro
             file = filespec
-            module, id = req.hdf['HTTP.PathInfo'].split('/', 3)[1:]
+            items = req.hdf['HTTP.PathInfo'].split('/', 2) + [None, None]
+            module = items[1] or 'wiki'
+            id = items[2] or 'WikiStart'
             if module not in ['wiki', 'ticket']:
                 raise Exception('Cannot reference local attachment from here')
         else:

Attachments

Change History

comment:1 Changed 7 years ago by cboos

  • Milestone set to 0.9
  • Owner changed from jonas to cboos
  • Status changed from new to assigned

My idea is that any wiki text in Trac always belongs to some
Trac object (see TracObjectModelProposal).
Sometimes, there's only one wiki text for a given Trac object,
like the content for a Wiki page.
Sometimes there are more of them, e.g. a ticket object
has the description plus any number of distinct comments.

You can see those concepts "at work" in the TracCrossReferences branch,
where I call those wiki texts the facets of an object.

On that branch, I'll refactor the wiki formatting methods
into member methods of the generic
TracObject.

I don't think it's a good idea to refactor the trunk so that
the wiki formatting methods take into account the (type,id)
of the "object" to which the wiki text being formatted belongs,
because that would be an extensive change which would conflict
with the direction taken by the TracCrossReferences branch.

So in the meantime, I'll apply your patch.

comment:2 Changed 7 years ago by mgood

  • Resolution set to fixed
  • Status changed from assigned to closed

Looks like cboos checked in [2018], but forgot to close this ticket.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.