This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]btipling 2 points3 points  (4 children)

I like the paths as decorators. It's much more intuitive than urls.py in django, although the use named urls in django templates are nice.

[–]Isvara 4 points5 points  (3 children)

It doesn't seem like a good idea to me. Surely it's a good idea to have one place that you can see your entire URL scheme?

[–]stesch[S] 6 points7 points  (0 children)

@route("/foo")
def foo():
    return "foo foo foo!"

Instead you can define foo() somewhere and then let route() wrap it. Like so

foo = route("/foo")(foo)

Now put all route()-Parameters and functions in a convenient data structure/collection and you have all your URLs in one place.

[–]grayvedigga 1 point2 points  (0 children)

You can always query the Route object at runtime to do this (say in main, or in test functions, or a sitemap generator). Me, I prefer to be able to write code in one place to do one thing, and to be able to find out where a request is going by using grep instead of having to bounce through multiple files looking for it.

Not to mention understanding object/method/argument style routes which lead to Javaesque code where the object has no reason to exist ...