[Grok-dev] View URLs?
Sebastian Ware
sebastian at urbantalk.se
Wed Jun 25 09:15:55 EDT 2008
25 jun 2008 kl. 12.03 skrev Tim Terlegård:
> 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)
>
And if you want to get the url to your application root from another
object's view you can do
view.url(grok.getSite())
Mvh Sebastian
More information about the Grok-dev
mailing list