[Grok-dev] view.url

Martijn Faassen faassen at infrae.com
Tue Oct 31 09:31:39 EST 2006

Christian Theune wrote:
> Hi,
> Martijn Faassen wrote:
>> Hi there,
>> Even though I haven't received feedback yet, I have implemented
>> view.url() as described at the bottom of my mail yesterday. I'll repeat
>> it here, slightly updated:
>> class IGrokView(Interface):
>>    # XXX haven't implemented this at the time of writing.
>>    def redirect(url):
>>        """Redirect to given URL"""
>>    def url(obj=None, name=''):
>>        """Construct URL.
>>        If no arguments given, construct URL to view itself.
>>        If only obj argument is given, construct URL to obj.
>>        If only name is given (or string as first argument, a bit of
>>        magic there), construct view URL to view with that name on our
>>        context.
>>        If both object and name arguments are supplied, construct
>>        view URL to view on that object.
>>        """
> Ah. I like this much better than what you described yesterday including
> 'parent_url', 'sibling_url' etc.

Yes, that was my initial thinking but it changed while going through the 
mail. It *was* in yesterday's mail. I still wonder whether parentUrl and 
siteUrl won't help us a bit, but we'll see (at least for parentUrl) once 
I tackle grokwiki.

> Passing an object and a name (subpath?) seems reasonable. 

Not sure what you mean with subpath.

> What about
> supporting query arguments via a dict?

Good idea. As keyword arguments might be prettier actually, though we 
have a risk we clash with the names 'obj' and 'name' then. Need to add 
that when we need it.



More information about the Grok-dev mailing list