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.On Jun 28, 1:16 pm, Branko Vukelic <[email protected]> wrote: > On Mon, Jun 28, 2010 at 9:50 AM, andrei <[email protected]> wrote: > > > I use auto-application too, it would be good to use url regexp of > > controller class in reverse, providing it parameters and thus > > generating url. > > I've seen only one framework (though I haven't seen too many of them > in general) that does this, and it's Ruby on Rails. However, it does > not use regexps for URL patterns, but rather its own DSL[1] (iirc). > Thus, I think it would not be feasible for regexp-based dispatcher to > do this. Unless re module provides tools for this kind of thing - and > I don't recall any - it'd mean reimplementing a regexp parser to do > the reverse lookup. It'd be painless to simply add a few custom > methods or instance methods to handle this. Django does this with > get_absolute_url method[2], and that's, I think, the best you can hope > for. > > [1]http://guides.rubyonrails.org/routing.html > [2]http://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddo... > > -- > 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.
