Modify ↓
#1829 closed defect (fixed)
ImageMacro may fail on WikiStart page
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.9 |
Component: | wiki system | Version: | devel |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal 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 (0)
Change History (2)
comment:1 by , 19 years ago
Milestone: | → 0.9 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Looks like cboos checked in [2018], but forgot to close this ticket.
Note:
See TracTickets
for help on using tickets.
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.