[Grok-dev] Re: Computing URLs relative to the application

Philipp von Weitershausen philipp at weitershausen.de
Thu Apr 5 02:18:45 EDT 2007


Martin Aspeli wrote:
> Philipp von Weitershausen wrote:
>> Martin Aspeli wrote:
>>> Philipp von Weitershausen wrote:
>>>> Hey there,
>>>>
>>>> I find it a very common requirement to compute URLs relative to the 
>>>> grok.Application object. I'm inclined to introduce an 
>>>> application_url() method on grok.View.
>>>>
>>>> Thoughts?
>>> +1, this is very common in Plone as well where we have a $portal_url 
>>> globally in the template namespace.
>>
>> Yes. Of course, that global stuff is evil (I just hope it'll go away 
>> in Plone). The natural namespace for such optimizations/shortcuts is 
>> the 'view' object.
> 
> Sure. But there should be some common mechanism in Grok for this (the 
> common view base class is probably fine) so that each view doesn't need 
> to define it for itself!

Yup, that mechanism is called subclassing :)


-- 
http://worldcookery.com -- Professional Zope documentation and training


More information about the Grok-dev mailing list