[Grok-dev] a grok.getApplication() implementation

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Nov 30 03:23:28 EST 2009

Kevin Teague wrote:
> On Nov 26, 10:18 pm, Christian Theune <c... at gocept.com> wrote:
>>> Not sure if there is a better way to do this?
>> There already is an implementation that acquires the application from a
>> view to return its URL.
>> In my projects I tend to complement that implementation with the same
>> algorithm that just returns the object instead of getting the URL.
> Yeah, I would like something which returns the actual application
> object, and not just it's URL. And I'd like to be able to call it
> outside of a view.
> I see that Jan-Wijbrand "Viewish" refactoring has just moved
> application_url into grok.util.application_url (leaving the original
> View method in place but just delegating to the util). So then you
> could have symmetry here by making a grok.util.application function
> instead of a grok.getApplication function. This would probably make
> more sense if people wanted to have a View.application() method to be
> symmetrical with View.application_url().
> Having a `grok.util.application(context)` function wouldn't be too
> bad, it does make the call more explicit as to where it's finding the
> application from, as opposed to how grok.getSite() or a
> grok.getApplication() appear to come from thin-air.
> I'm not too fussy on any of these choices, but I would like an easy
> way to get to the application object itself within Grok.


Having a grok.util.application(context) function makes sense to me. It 
also makes sense to consolidate grok.util.application_url()'s 
implementation to use grok.util.get_application(context).

Let's build it.


More information about the Grok-dev mailing list