Edgewall Software
Modify

Opened 17 years ago

Closed 15 years ago

#6254 closed defect (worksforme)

autonav macro for 0.11 with wrong definition name

Reported by: alex@… Owned by: Christian Boos
Priority: low Milestone:
Component: wiki system Version: devel
Severity: minor Keywords: autonav macro
Cc: ryank@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Please bear with my python ignorance, but I think the AutoNav macro version for 0.11 is not correct. At the macro bazaar page it is labeled as example macro for 0.11 so I thought it should work with the current r6102. in the file http://trac.edgewall.org/attachment/wiki/MacroBazaar/autonav-trac-0.11.py line 38 I think:

def render_macro(self, formatter, name, args):

should rather be:

def expand_macro(self, formatter, name, args):

as render_macro seems to me, is the old way and the parameters are different then.


further the next line 39, which checks

if formatter.context.resource != 'wiki':

doesn't work for me, so I disabled it as I don't know how to fix it.


I also added

        if len(pages) == 0:
            return ''

in order to prevent orphaned pages from throwing an error.


at the end I changed the loop through the pages list as the last line seemed wrong to me too, although in this case, I think it is rather me not being familiar with python syntax.

Attachments (0)

Change History (9)

comment:1 by Christian Boos, 17 years ago

Component: generalwiki
Milestone: not applicable
Owner: changed from Jonas Borgström to Christian Boos

You're right, the API has changed once more since then, it's now expand_macro. The formatter indeed holds a Context object, but the API of that class has been subject to some fine tuning as well ;-)

comment:2 by ryank@…, 17 years ago

Cc: ryank@… added

comment:3 by osimons, 17 years ago

How is this an issue for the Trac project? Would it not be better if the plugin was migrated to trac-hacks.org and maintained there?

comment:4 by anonymous, 17 years ago

I wrote: At the macro bazaar page it is labeled as example macro for 0.11

I thought, if a plugin is mentioned in the trac project documentation as being an example for the new macro style, it is indeed related to the trac project.

I'd say either fix it or do not mention it as example and starting point to write a macro, as it adds confusion and frustration for people who are just starting with trac and do NOT see at the first glance, that the plugin is old.

in reply to:  4 ; comment:5 by osimons, 17 years ago

Replying to anonymous:

I thought, if a plugin is mentioned in the trac project documentation as being an example for the new macro style, it is indeed related to the trac project.

I'd say either fix it or do not mention it as example and starting point to write a macro, as it adds confusion and frustration for people who are just starting with trac and do NOT see at the first glance, that the plugin is old.

Re-reading my comment:3, I see it is badly phrased. I was pondering MacroBazaar for a while, and thinking about it in terms of what to do with it as the Trac project. My question is basically a question to ourselves on how to handle it. What I left out was actually adressing the other Trac developers…

So, it is very natural that you do register a ticket, and no fault on your part! Sorry if it came out wrong - it was by certainly not my intention.

in reply to:  5 comment:6 by alex@…, 17 years ago

I agree, that trac-hacks is a better place to store everything plugin or macro related. So yes, a link to trac-hacks may do it. Hopefully trac-hacks will never again have a six week outage, though… :-)

in reply to:  5 comment:7 by osimons, 17 years ago

Replying to osimons:

I was pondering MacroBazaar for a while, and thinking about it in terms of what to do with it as the Trac project. My question is basically a question to ourselves on how to handle it. What I left out was actually adressing the other Trac developers…

This discussion is now continued on GoogleGroups:trac-dev:72a6cfaeb3f063e8

comment:8 by ed.spittles@…, 15 years ago

There are a few more improvements in a patch posted here (Japanese site)

As cboos was kind enough to attach a tar file to the MacroBazaar page, and as that page is the top hit when searching for the very useful AutoNav, it would be great to see a corrected attachment!

(I already had the formatter.context.resource.realm fix, somehow.)

comment:9 by Christian Boos, 15 years ago

Milestone: not applicable
Resolution: worksforme
Status: newclosed

Anyone can update the stuff in the MacroBazaar, though the TracHacks has become a more successful bazaar these days :-)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.