AW: [Zope3-Users] Weird behaviour of ViewPageTemplateFile()

Roger Ineichen dev at projekt01.ch
Thu Apr 10 09:35:21 EDT 2008


Hi Martin

> Betreff: [Zope3-Users] Weird behaviour of ViewPageTemplateFile()
> 
>    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
> class:
> 
>      class MyView(BrowserView):
>          def __call__(self):
>              self.pt = ViewPageTemplateFile('empty.pt')
>              data = self.pt()
>              return data
> 
>    That works fine. However, I don't really need pt as 
> instance variable, so I turned it into a local variable:
> 
>      class MyView(BrowserView):
>          def __call__(self):
>              pt = ViewPageTemplateFile('empty.pt')
>              data = pt()
>              return data

try this:
 
pt = ViewPageTemplateFile('empty.pt')
return pt(self)

Regards
Roger Ineichen



More information about the Zope3-users mailing list