[Grok-dev] Re: viewlets and application_root

Luciano Ramalho luciano at ramalho.org
Fri Apr 25 03:27:56 EDT 2008


On Thu, Apr 24, 2008 at 6:20 PM, Martijn Faassen <faassen at startifact.com> wrote:
>  I think there's a good use case for adding such functionality to both grok
> itself (just like grok.url()) and to the view (and viewlet, I guess). We
> already have application_url() which does much the same, but then gets the
> URL right away. We should factor the walk-up-the-tree functionality out.
>
>  Contributions would be welcome!
>
>  (As an alternative I often use grok.getSite(), but that will only work for
> applications that have no sub-sites in it, so the tree walking would be
> better here)

That's easy enough that even I can implement it, so I'll do it.

I know where the relevant code is because I actually duplicated part
of it in kirbi.

What should we call the function?

grok.getApplication() follows the pattern of grok.getSite(). Is that ok?

BTW I see a naming inconsistency between grok.application_url() and
grok.getSite(). Should we do something about it?

Cheers,

Luciano


More information about the Grok-dev mailing list