[Product-Developers] Re: getting CompositePack's Navigation Page from a viewlet

Héctor Velarde hvelarde at jornada.com.mx
Sat Jan 19 03:34:55 UTC 2008


Carlos de la Guardia wrote:
> The thing is that to access variables sent as parameters when calling a 
> page template as a method, you need to use 'options'.
> 
> <p tal:content="options/viewlet/id">

thanks, Carlos! that explains everything.

I have another question: is it possible to pass values to the viewlets 
in the same way as these options are passed?

why? because I need to check if some objects are already referenced on 
the composite page and I want to filter them from my viewlet.

let me explain better: the frontpage of the newspaper will have 2 
sections: the upper section contains the most relevant stories from the 
publisher point of view. the lower section will contain the most recent 
stories ordered by creation date, and this list is generated automatically.

if a publisher already selected an article for the upper part I want to 
filter it from the results of the lower part.

I already found a way to list the objects in certain slot inside the 
viewlet:

<p tal:define="slots python:options['slots']['first'].objectItems()">
     first: <span tal:content="python:', 
'.join([slot[1].getTarget().Title() for slot in slots])" />
</p>

but, as I have 9 sections on the newspaper and I am using this to list 
the articles by section (using Smart Folders), I would have to call this 
in the viewlet for every Smart Folder; that is, 9 times.

I think this can cause performance problems so I want to obtain the list 
of elements to filter in the context of the composite page and then pass 
this list to the viewlets as a preset variable.

any hints?

saludos





More information about the Product-Developers mailing list