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

Philipp von Weitershausen philipp at weitershausen.de
Fri May 9 20:37:24 EDT 2008


Jan-Wijbrand Kolman wrote:
> 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.
> 
> Like the others I'm quite fond of this idea too.
> 
> This would actually mean, we do not need to supply a url() method on 
> viewlet(managers) after all, because you have easy access to the view 
> and thus you can easily (and completely similar to "normal" views) call 
> view.url() in your template.

Yes, I think it's very attractive for that reason.

> This would 1) result in less code to maintain, 2) opening up the 
> possibility to create at some point in time a viewlet.url() that 
> constructs the URL to the individual viewlet.

Right. We just need to be crystal-clear in documentation that our 
viewlets are different from Zope 3's regular viewlets in this regard. 
Normally, the rule in Zope 3 is this: if you have a class and an 
associated template, the class's instance is available in the template 
namespace under 'view', no matter what it really is. I realize that the 
idea proposed above is more attractive and I support it, we just need to 
be careful to document it well.


More information about the Grok-dev mailing list