[Zope3-Users] Weird behaviour of ViewPageTemplateFile()
Martin J. Laubach
mjl at laubach.at
Thu Apr 10 09:22:33 EDT 2008
I just stumbled over something that utterly baffles me and hope
someone can point out the absolutely obvious to me.
I've got a view defined in a configure.zcml that points to this
self.pt = ViewPageTemplateFile('empty.pt')
data = self.pt()
That works fine. However, I don't really need pt as instance
so I turned it into a local variable:
pt = ViewPageTemplateFile('empty.pt')
data = pt()
And that version throws an exception:
Traceback (innermost last):
Module ZPublisher.Publish, line 119, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 42, in call_object
Module mjl.example.browser.myform, line 31, in __call__
Module Shared.DC.Scripts.Bindings, line 313, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Shared.DC.Scripts.Bindings, line 1, in ?
Module Shared.DC.Scripts.Bindings, line 293, in
AttributeError: 'str' object has no attribute 'other'
Same if I just do the simpler "return ViewPageTemplateFile
I simply do not understand why, what or who does care how I name my
variables or where I put them? Please hit me hard with a cluebat. Twice.
More information about the Zope3-users