[z3-five] template pages now work

Martijn Faassen faassen at infrae.com
Thu Jun 17 20:27:08 MEST 2004


Hi there,

We now have 9 unit tests and we're actually supporting page templates! 
To do this I had to introduce some dependencies on zope.app, and to 
resort to some magic here and there, but it all seems to be working 
quite well now.

What you can do after today's changes is the following:

   <five:page
     for=".interfaces.ISimpleContent"
     class=".browser.SimpleContentView"
     template="falcon.pt"
     name="falcon.html"
     />

where falcon.pt is some page template on the file system. The 'class' 
attribute is optional.

In your page template, you can refer to the object viewed using 
'context', the view itself (to call methods on it) with 'view', and to 
other views using 'views'.

The page template engine used is Zope 3's, and absolutely no security 
checks are taking place within the page templates. You can do a security 
check when an attribute is called in the normal Zope 2 way, of course. 
For templates, we need a mechanism to declare access to a particular 
template protected; while the template itself and everything it calls 
will run as trusted code, at least access to the template should be 
protectible.

A nice way to do this would be to drive Zope 2's security using a 
'permission' attribute in ZCML. Any Zope 2 experts around who know how 
to set security on a class programmatically from the outside of the class?

Regards,

Martijn


More information about the z3-five mailing list