[Zope3-Users] Output the template of a view class

Florian Lindner mailinglists at xgm.de
Wed Jun 22 11:57:01 EDT 2005


Am Mittwoch, 22. Juni 2005 08:34 schrieb Sven Schomaker:
> Hi Florian,
>
> AFAIK there is actually no need to manually return
> the pagetemplate if you've registered your page via
> zcml, since the page directive creates a new
> SimpleViewClass with your class definition and
> template as a mix-in.

A __call__ without any return cause the template to output nothing.

>
> Nevertheless the SimpleViewClass created exposes the
> template provided by the zcml as an attribute
> called 'index' and returns it in the __call__ method
> itself.
>
> Look at the code in zope.app.pagetemplate.simpleviewclass
> to see how it works.
>
> So if your willing to return the template yourself, just
> define the __call__ method in your view class like this:
>
> def __call__(self):
>     return self.index()


This works!

Thanks,

Florian

>
> This should do the trick (Tried it myself to assure
> not being mistaken, but if so please don't let me die
> untaught!). But you definetly should not have to do it,
> since it's supposed to work right out of the box.


More information about the Zope3-users mailing list