Opened 8 years ago

# Fails with multiple pages and AddComment macro

Reported by: Owned by: roger@… Álvaro Iradier normal TracWikiPrintPlugin normal 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'>


### comment:1 Changed 8 years ago by Álvaro Iradier

Status: new → assigned

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
raise TracError('\'AddComment\' macro cannot be included twice.')



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.

log when failure

### comment:2 Changed 8 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 8 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

### Modify Ticket

Change Properties