That gives problems when I use it on Plone 4.2 when using Chameleon/five.pt (so not standard Plone out of the box). Some tests go wrong or at least give extra error output. It also happens when as anonymous user you try to view a document that is private. You are redirected to the login page just fine, but in the logs you get an error:
Traceback (most recent call last):
File "/Users/mauritsvanrees/shared-eggs/zExceptions-2.13.0-py2.7.egg/zExceptions/ExceptionFormatter.py", line 153, in formatLine
supp = factory(*args)
File "/Users/mauritsvanrees/community/plone-coredev/4.2/src/zope.pagetemplate/src/zope/pagetemplate/pagetemplate.py", line 265, in __init__
e = pt.pt_errors(namespace, check_macro_expansion=False)
TypeError: pt_errors() got an unexpected keyword argument 'check_macro_expansion'
You get the same error twice, actually.
The problem is that not all page templates that are passed to the PageTemplateTracebackSupplement are from zope.pagetemplate. In the above case the class of the template is Products.CMFCore.FSPageTemplate.FSPageTemplate.
This simple change in pagetemplate.py would fix it for me:
- e = pt.pt_errors(namespace, check_macro_expansion=False)
+ try:
+ e = pt.pt_errors(namespace, check_macro_expansion=False)
+ except TypeError:
+ # Old page template.
+ e = pt.pt_errors(namespace)
I am not sure if that is the best way to go.
Alternatively, the pt_errors in Zope2/src/Products/PageTemplates/PageTemplate.py could be changed to accept check_macro_expansion as argument (and probably ignore it).
4.0.0 has been released on PyPI.
That gives problems when I use it on Plone 4.2 when using Chameleon/five.pt (so not standard Plone out of the box). Some tests go wrong or at least give extra error output. It also happens when as anonymous user you try to view a document that is private. You are redirected to the login page just fine, but in the logs you get an error:
Traceback (most recent call last): mauritsvanrees/ shared- eggs/zException s-2.13. 0-py2.7. egg/zExceptions /ExceptionForma tter.py" , line 153, in formatLine mauritsvanrees/ community/ plone-coredev/ 4.2/src/ zope.pagetempla te/src/ zope/pagetempla te/pagetemplate .py", line 265, in __init__ namespace, check_macro_ expansion= False) macro_expansion '
File "/Users/
supp = factory(*args)
File "/Users/
e = pt.pt_errors(
TypeError: pt_errors() got an unexpected keyword argument 'check_
You get the same error twice, actually.
The problem is that not all page templates that are passed to the PageTemplateTra cebackSupplemen t are from zope.pagetemplate. In the above case the class of the template is Products. CMFCore. FSPageTemplate. FSPageTemplate.
This simple change in pagetemplate.py would fix it for me:
- e = pt.pt_errors( namespace, check_macro_ expansion= False) namespace, check_macro_ expansion= False) namespace)
+ try:
+ e = pt.pt_errors(
+ except TypeError:
+ # Old page template.
+ e = pt.pt_errors(
I am not sure if that is the best way to go. Products/ PageTemplates/ PageTemplate. py could be changed to accept check_macro_ expansion as argument (and probably ignore it).
Alternatively, the pt_errors in Zope2/src/