Modify

Opened 14 years ago

Last modified 5 years ago

#6784 new defect

Fails with multiple pages and AddComment macro

Reported by: roger@… Owned by:
Priority: normal Component: TracWikiPrintPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

I am using TracWikiPrintPlugin to make a PDF from a couple of pages. These pages may each have the AddComment macro. It seems, however, that when TracWikiPrintPlugin is doing it's thing, the pages are handled in such a way that the TracAddCommentMacro macro thinks it has been added more than once. This is not the case on any individual page. I can view all the constituent pages just fine. It is only the TracWikiPrintPlugin processing that has a problem. From the log:

2010-03-09 08:54:16,396 Trac[formatter] ERROR: Macro AddComment(None) failed: 
Traceback (most recent call last):                                            
  File "/usr/lib/python2.5/site-packages/Trac-0.12multirepos-py2.5.egg/trac/wiki/formatter.py", line 494, in _macro_formatter
    return macro.process(args, in_paragraph=True)                                                                            
  File "/usr/lib/python2.5/site-packages/Trac-0.12multirepos-py2.5.egg/trac/wiki/formatter.py", line 192, in process         
    text = self.processor(text)                                                                                              
  File "/usr/lib/python2.5/site-packages/Trac-0.12multirepos-py2.5.egg/trac/wiki/formatter.py", line 179, in _macro_processor
    text)
  File "build/bdist.linux-i686/egg/addcomment/macro.py", line 41, in expand_macro
    raise TracError('\'AddComment\' macro cannot be included twice.')
TracError: 'AddComment' macro cannot be included twice.
2010-03-09 08:54:16,549 Trac[macros] WARNING: Executing pre-0.11 Wiki macro Include by provider <class 'includemacro.macros.IncludeMacro'>

Attachments (1)

l1.txt (7.7 KB) - added by roger@… 14 years ago.
log when failure

Download all attachments as: .zip

Change History (5)

comment:1 Changed 14 years ago by Álvaro Iradier

Status: newassigned

Could you include the full log for the page conversion?

I guess this is a problem with AddComment checking it's not being included twice in the same web page. WikiPrint renders all the book pages from wiki syntax to HTML, and AddComment might think it's been included twice:

        # Prevent multiple inclusions - store a temp in req
        if hasattr(req, 'addcommentmacro'):
            raise TracError('\'AddComment\' macro cannot be included twice.')
        req.addcommentmacro = True

a workaround for this could be removing the addcommentmacro attribute from the request, but I think this is a dirty fix. Maybe it'd be better to restore the previous req state, or maybe the fix should be in AddCommentMacro (for example, store the name of the page instead of just True in the request attribute.

Changed 14 years ago by roger@…

Attachment: l1.txt added

log when failure

comment:2 Changed 14 years ago by roger@…

l1.txt is the full log when the page creation fails. Oddly, the failure is not 100% of the time. Sometimes it works. Same pages (no content changes) and same order.

comment:3 Changed 14 years ago by Álvaro Iradier

I think the log is showing only WARNING and ERROR information, could you lower log level to DEBUG?

Also, I reported this to AddCommentMacro in #6785

comment:4 Changed 5 years ago by Ryan J Ollos

Owner: Álvaro Iradier deleted
Status: assignednew

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.

Add Comment


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

 
Note: See TracTickets for help on using tickets.