[Grok-dev] view.url

Christian Theune ct at gocept.com
Tue Oct 31 09:33:45 EST 2006


Hi,

Martijn Faassen wrote:
> 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.

Must not have read carefully enough. Anyway, I like the outcome.

>> Passing an object and a name (subpath?) seems reasonable. 
> 
> Not sure what you mean with subpath.

I guess I could just do this:

view.url(wikipage, 'yada/yada/?yada=yada')

right now?

> 
>> 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.

Yupp.

-- 
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20061031/b0a1cadd/signature.bin


More information about the Grok-dev mailing list