The example I posted is a very simple case.

def link_to(title):
    return '/base/url/%s' % title

It obviously has no generality, so you will have to define this kind
of method for each URL patern. If you want to make this more abstract,
you'd probably spend a lot more time on it or have some way of
defining the base string for use in string formatting somewhere in
your class. And it also needs some argument cleanup for security
reasons, obviously.

On Mon, Jun 28, 2010 at 4:02 PM, andrei <[email protected]> wrote:
> I think it requires patching metaclass in web.autoapplication.
> Cannot find your example, can you paste it once more?
>
>
> On Jun 28, 3:21 pm, Branko Vukelic <[email protected]> wrote:
>> On Mon, Jun 28, 2010 at 1:14 PM, andrei <[email protected]> wrote:
>> > Django way looks ok, but maybe its simpler to implement with Python
>> > string formatting, adding url argument in controller url="/users/%
>> > {name}d" so generating url would be calling operator % and providing
>> > it with keyword arguments.
>>
>> Yes. That's how you'd do it without reverse-regexp. I think I've given
>> the example in this topic earlier. This is not rocket science. Just
>> write a simple method (don't forget to do proper validation, though, I
>> skipped that for simplicity) and use that in your template.
>>
>> Regards,
>>
>> --
>> Branko Vukelić
>>
>> [email protected]
>> [email protected]
>>
>> Check out my blog:http://www.brankovukelic.com/
>> Check out my portfolio:http://www.flickr.com/photos/foxbunny/
>> Registered Linux user #438078 (http://counter.li.org/)
>> I hang out on identi.ca:http://identi.ca/foxbunny
>>
>> Gimp Brushmakers Guildhttp://bit.ly/gbg-group
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web.py" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/webpy?hl=en.
>
>



-- 
Branko Vukelić

[email protected]
[email protected]

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to