[Grok-dev] Re: issue #226555: viewlet.url() and how to solve it

Martijn Faassen faassen at startifact.com
Thu May 8 13:22:54 EDT 2008

Hey Kevin,

Thanks for your feedback!

Kevin Smith wrote:
> Thinking out loud, it may be possible in a viewlet to map the 'view'
>  namespace directly to the parent view and then supply a 'viewlet' 
> namespace that maps directly to the viewlet.

This sounds attractive. It of course makes sense to have 'view'
still map to a view, and a viewlet will always
have a view available. It will work for the refactoring a view into 
viewlets use case, and it makes it clear whether you're accessing 
methods on a view or a viewlet.

+1 for exploring this: a 'view' namespace in the template which points 
to a real view, and a 'viewlet' namespace in the template that points to 
the viewlet. I think in this case it would make sense to establish a 
'view' attribute in the viewlet class as well.

One thing we need to check is how Zope 3's viewlets support does it now. 
What does 'view' mean in a viewlet's template in straight Zope 3? We 
shouldn't necessarily follow this approach, but we should at least be 
aware of what it's doing.

>>> * Related question: during the sprint someone expressed the
>>> desire for a way to construct URLs to individual viewlets. How
>>> does that relate to this issue? Or should we ignore this for now?
>> Ignore this for now; viewlets don't really have URLs (yet) in Grok
>>  anyway.
> +1, this is muddying up the issue and it is really a separate case. I
>  propose implementing a new type of viewlet to signify such extended
>  functionality, like ViewletPage or something.

Alternatively a directive to do such exposure. Though for the general
caching scenario where you want to use a caching server like Varnish and
do re-integration later, you'd need URLs for all viewlets. Anyway,
another topic.



More information about the Grok-dev mailing list