Because url_for depends on a global singleton which violates encapsulation and makes it harder to nest applications. Plus the same function does a lot of different things, generating routes by name, or by variable matching, or based on the current URL, or based on a literal URL passed in. These should have all been different methods so it wouldn't have to guess which one was desired. It was all borrowed from Rails and later we realized it was unpythonic and hard to maintain. So it was a choice of either supporting it as-is forever or making it more deterministic.
On Sun, Apr 11, 2010 at 7:00 AM, karantan <[email protected]> wrote: > and why does pylons implements thing that already exists? > > On Apr 10, 4:02 pm, Marius Gedminas <[email protected]> wrote: >> On Wed, Apr 07, 2010 at 11:16:00PM -0700, Didip Kerabat wrote: >> > Hi all, >> >> > I've heard that url_for() is going to be deprecated in favor of url(). Is >> > that correct? >> >> > That said, I saw only url_for method in routes/util.py source code. >> >> > Can anyone enlighten me? >> >> url() is not a Routes thing, it's a Pylons thing: >> >> from pylons import url >> >> url(controller='foo', action='bar', id=42) >> >> It is an instance of routes.util.URLGenerator(), wrapped in a >> StackedObjectProxy. >> >> Incidentally, it doesn't help that the doc index on pylonshq.com has the >> wrong url() listed inhttp://pylonshq.com/docs/en/0.9.7/index/#U >> >> Marius Gedminas >> -- >> I have yet to see any problem, however complicated, which, when >> you looked at it in the right way, did not become still more complicated. >> -- Poul Anderson >> >> signature.asc >> < 1KViewDownload > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" 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/pylons-discuss?hl=en. > > -- Mike Orr <[email protected]> -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.
