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

Florian Lindner mailinglists at xgm.de
Tue Jun 21 13:36:12 EDT 2005


Am Dienstag, 21. Juni 2005 18:41 schrieb Jim Fulton:
> Florian Lindner wrote:
> > Hello,
> > sine I suspect my last email to have drowned on the list, I try to ask
> > again.
> >
> > How can I ouput the template from the associated view class?
> >
> > class view:
> >         def __call__(self):
> >                 return template
> >
> > How to do that?
>
> Assuming that the template was defines via ViewPageTemplateFile, then:

It is defined with ZCML:

    <page
        name="usersettings.html"
        for="CS.centershock.interfaces.ICentershock"
        template="usersettings.pt"
	[...]
        class=".views.UserSettings" />

>    return self.template()

  File 
"/home/florian/Desktop/zope/lib/python/CS/centershock/browser/skin/views.py", 
line 24, in __call__
    return self.template()
AttributeError: 'SimpleViewClass from /home/florian/Desktop/zope/li' object 
has no attribute 'template'

I wonder why the last path is truncated... However, it does not work.

Thanks,

Florian


More information about the Zope3-users mailing list