Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#94 closed defect (worksforme)

Macro ListTypes failed under Trac 0.9.2

Reported by: leiss@… Owned by: athomas
Priority: normal Component: TracHacksPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

Since I've updated my insatllation to 0.9.2
I'm getting this error if I use "ListTypes"

 Error: Macro ListTypes() failed

'NoneType' object has no attribute 'title'

Attachments (0)

Change History (3)

comment:1 Changed 9 years ago by athomas

  • Component changed from TracHacks to TracHacksPlugin
  • Resolution set to worksforme
  • Status changed from new to closed

Are you using the TracHacksPlugin?

It works fine here and with the information you've provided I can't really help you. I would need at least a traceback.

comment:2 Changed 9 years ago by anonymous

Yes, I'm using TracHacksPlugin.

2005-12-13 17:09:27,970 Trac[formatter] ERROR: Macro ListTypes() failed
Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 376, in _macro_formatter
    return macro.process(self.req, args, 1)
  File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 110, in process
    text = self.processor(req, text)
  File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 101, in _macro_processor
    return macro_provider.render_macro(req, self.name, text)
  File "build/bdist.linux-i686/egg/trachacks/trachacks.py", line 50, in render_macro
AttributeError: 'NoneType' object has no attribute 'title'

comment:3 Changed 9 years ago by athomas

Aha..the way ListTypes works is to use the first level 1 heading as the "title". eg. = Foo =

I'll update the source. Apply this diff and it should fix the bug:

  • trachacks/trachacks.py

     
    4747                    title = title.group(1).strip() 
    4848                    body = re.sub('=+\s([^=]*)=+', '', body, 1) 
    4949                else: 
    50                     title = title.title() 
     50                    title = page 
    5151                body = re.sub('\\[\\[TagIt.*', '', body) 
    5252                out.write('<legend style="color: #999;"><a href="%s">%s</a></legend>\n' % (self.env.href.wiki(page), title)) 
    5353                out.write('%s\n' % wiki_to_html(body, self.env, req)) 

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.