[Zope3-Users] Weird behaviour of ViewPageTemplateFile()

2008-04-10 Thread Martin J. Laubach
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(

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

2008-04-10 Thread Martin J. Laubach
class MyView(BrowserView): def __call__(self): pt = ViewPageTemplateFile('empty.pt') data = pt() return data try this: pt = ViewPageTemplateFile('empty.pt') return pt(self) Nope, same result: AttributeError: 'str' object has no attri

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

2008-04-10 Thread Martin J . Laubach
> Well, it's called a *View*PageTemplate for a reason :-) If the file is > really empty and you do not need to pass any arguments to it (view, > context, request), use a plain PageTemplateFile No, of course it's not empty and it needs the parameters. Nor does the view really look as trivial a

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

2008-04-10 Thread Martin J . Laubach
> ViewPageTemplate must be in the view's namespace, and it magically > fishes out the view, view's context and request, and makes them > available in the TAL namespace. Ah, so there _IS_ heavy magic involved here. Thanks for clarifying that, I was already doubting my sanity! Cheers,

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

2008-04-10 Thread Martin J. Laubach
> ViewPageTemplate must be in the view's namespace, and it magically > fishes out the view, view's context and request, and makes them > available in the TAL namespace. Ah, so there _IS_ heavy magic involved here. Thanks for clarifying that, I was already doubting my sanity! This is exactly t