I am using 0.11 trunk and the autonav macro whichis marked as 0.11
compatible simply doesn't work in my installation.
from the look at the code, which is linked from the trac macro bazaar
page (<http://trac.edgewall.org/attachment/wiki/MacroBazaar/autonav-
trac-0.11.py>) it seems to me (=> python noob) that it is not
formatted correctly. (most of the block in the defrender_macro seems
to be shift right and "def link(page):" appears to be wrong to me
also)
but even, if I change the above it still doesn't work, throwing an
error (raise AttributeError(name) in web/api.py -> __getattr__) at the
line:
if formatter.context.resource != 'wiki':
commenting this if statement give me the error at the next line, when
accessing the db.cursor.
cursor = formatter.db.cursor()
so it looks like "formatter" is not, what it is supposed to be, it
hasn't "context" nor has it "db".
I'd like to learn to deal better with debugging the python scripts.
I know about self.env.log.info, which gives me:
<Request "POST u'/wiki/Weblinks'"> as value of formatter.
how can I get more info on formatter?
render_macro
I changed it to:
expand_macro
which solved the problem with the formatter object.
still the indentation of the downloaded file seems wrong on my end
(using the download link, if I browse the source it seems to be
correctly formatted)
being a python noob, I was wrong earlier with the
def link(page):
function being wrong indented. indeed it works like it was before.
only thing left is that the if statement at the beginning fails:
if formatter.context.resource != 'wiki':
it always is false as formatter.context.resource doesn't seem to be a
string.
commenting both lines out solved the problem in wiki pages, but still
I think, they were put there for a good reason and might only get a
little fix.
can anybody help what the correct if test should look like ?