[Zope-CMF] Re: Moving to browser views

Rob Miller ra at burningman.com
Wed Jul 18 16:07:12 EDT 2007


Charlie Clark wrote:
> Hi,
> 
> I making my first stab at browser views for my iCal support having 
> finally come up with some templates that seem to produce files that work 
> with most calendar programs.
> 
> I have a couple of questions:
> 1) should I implement them as BrowserViews calling templates or should I 
> use an adapter? The templates are TAL and the only difference to an HTML 
> page is the different response header.

i think the most common idiom is to use <browser:page> directives, pointing at 
a BrowserView subclass, using either "template" or "attribute" within the 
directive to specify the action to take.

> 2) how do I pass in values derived specifically for these views? ie. 
> going from
> options = {}
> options['name'] = charlie
> ...
> return context.mytemplate(**options)

while it may be appropriate in some cases to pass values directly into the 
template like this, usually the template pulls the values from the view class. 
  you can make "name" an attribute (or a property) of the view class, and then 
use the "view/name" TALES expression within the template.

-r



More information about the Zope-CMF mailing list