Edgewall Software

Ticket #1829 (closed defect: fixed)

Opened 3 years ago

Last modified 2 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:

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

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned
  • milestone set to 0.9

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.

Changed 3 years ago by mgood

  • status changed from assigned to closed
  • resolution set to fixed

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

Add/Change #1829 (ImageMacro may fail on WikiStart page)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.