[z3-five] Formlib custom template - AttributeError: debug.

Tim Terlegård tim at se.linux.org
Fri Feb 16 12:06:35 CET 2007


> Traceback (innermost last):
>   Module ZPublisher.Publish, line 115, in publish
>   Module ZPublisher.mapply, line 88, in mapply
>   Module ZPublisher.Publish, line 41, in call_object
>   Module zope.formlib.form, line 758, in __call__
>   Module zope.formlib.form, line 752, in render
>   Module zope.app.pagetemplate.viewpagetemplatefile, line 83, in __call__
>   Module zope.app.pagetemplate.viewpagetemplatefile, line 47, in __call__
>   Module ZPublisher.HTTPRequest, line 1219, in __getattr__
> AttributeError: debug

I got this yesterday as well. Zope 3 requests has a debug attribute, but
Zope 2 requests have not. So there's a problem when Zope 3 code uses the
Zope 2 request and expects there to be a debug attribute.

I fixed this by adding the debug attribute to the ZPlublisher.HTTPRequest
class inside __init__:

    from zope.publisher.base import DebugFlags
    self.debug = DebugFlags()    # inside __init__

Philipp said it will be fixed in Zope 2.11 or something. But there's no
way we can wait that long to get our stuff working  :)

Tim


More information about the z3-five mailing list