[Zope-dev] z3c:pagelet with template attribute error

Gaël Pasgrimaud gael at gawel.org
Thu Mar 13 16:51:37 EDT 2008


Hello,

the z3c:pagelet directive have a strange behavior when you provide a
template attribute. The template path is not resolved like in standard
browser:page so when you try to call your pagelet you get a "unicode
is not callable" error.

I know that the way to associate a template to a pagelet is to use a
z3c:template or a class attribute but this behavior can make a lot of
people confused.

So I see two options:

- resolve the template path in the directive and give a real
ViewPageTemplateFile to the class like in browser:page

- raising a ConfigurationError if a template key is found in **kwargs
if you want to force the use of z3c:template.

I like the first one because you don't always need a z3c:template and
writing template="sample.pt" is shorter than from ... import
ViewpageTemplateFile; template = ViewPageTemplateFile('sample.pt').
May be i can give a patch for this. Let me know.

Regards,

--
Gael


More information about the Zope-Dev mailing list