On Tuesday 26 June 2007 12:46, Hermann Himmelbauer wrote:
> At first, thanks for your reply, this clears things up a lot for me. The
> link to the Blog-entry above was also very valuable.
> What I still don't understand is how to implement a simple, quasi-static
> html-page. With browser:page I'd do it like this:
I'll note that Zope 3 does a lot of black magic to make this directive work
> And the template "mypage1.pt" would e.g. use the "body" macro and have some
> static content.
> In case of pagelets, I'd do it like this (correct me if I'm wrong):
> And then I'd have to implement an interface and a class:
> class IMyAppPage1(zope.interface.Interface):
> class MyAppPage1(BrowserPagelet)
> This is a lot more code than with the browser:page example.
> As a solution, I'm thinking about a magic "template" directive in the
> z3c:pagelet namespace, e.g. something like that:
This example is longer than it needs to be. For starters, you do not need the
interface; in your example it serves no use. Optionally, if you do not need
to keep template registration independent of view registration, the following
will work as well:
template = viewpagetemplatefile.ViewPageTemplateFile('mypage1.pt')
In our experience, we rarely do static pages, maybe one every 20-30 other
views. Then, we purposefully did not provide the semantics of the
browser:page directive, because we *want* transparency. So why optimize this
rare use case at the cost of losing transparency?
> Perhaps in case of this "template" directive, the interface/view class
> could be created on the fly? What do you think?
No, one of the (maybe implicit) goals of pagelets is to require view classes
and get rid of the class building magic.
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
Zope3-users mailing list