[Grok-dev] View URLs?

Tim Terlegård tim.terlegard at valentinewebsystems.se
Wed Jun 25 06:03:39 EDT 2008

On Jun 25, 2008, at 7:57 AM, Kenneth Miller wrote:

>     So I've got a single app with an exra Grok.Container and  
> Grok.Model. I've defined ONE index view that inherits from  
> zope.Interface so that it's available to essentially any Model/ 
> Container and the app. The way this is setup allows me to use the  
> index template to provide a consistent look and feel to my app, and  
> particularly navigation. The problem I'm currently having is that my  
> template uses view.url('this') methods to access other views, which  
> works fine, but only when you're viewing the base app. For example
> The format for below is as follows:
> Container/View
>   Link  -> Generated result.
> App/index
>   MyPage1 -> app/mypage1
> App/Container/index
>   MyPage1 -> app/container/mypage1        when this should be  
> pointing to app/mypage1
> How should I handle this? There's no url methods attached to the App  
> object.

The url method accepts obj and name parameters.

     In grok 0.12
     def url(self, obj=None, name=None):

     In grok 0.13
     def url(self, obj=None, name=None, data=None):

So you can call view.url(obj=app)


More information about the Grok-dev mailing list