In web.py you define all your routes in an array, as the first argument to the web.application method. Each route also gets an associated class. In Bottle, each route is defined by a function decorator and is associated with a function. You could see that by comparing the front pages of both web sites.
mitsuhiko2 points · Mar 2010 · :flask-logo: Flask Creator
The downside of the decorators is, that you have to import all the views before the server runs for the registration to kick in. The advantage is that the URL rule is closer to the function.
In bottle, you can add new routes at any time, even from within a callback while the server is running. If you want to define your callbacks first and add the routes later, you can use the decorator as a normal function:
mitsuhiko2 points · Mar 2010 · :flask-logo: Flask Creator
Obviously that will work. However, that is completely irrelevant to the discussion decorator or explicit mapping. One can easily be converted to the other.
In web.py you define all your routes in an array, as the first argument to the web.application method. Each route also gets an associated class. In Bottle, each route is defined by a function decorator and is associated with a function. You could see that by comparing the front pages of both web sites.
xamdam 1 points · Mar 2010
Thanks. I guess I was wondering what the advantage or specialization is
mitsuhiko 2 points · Mar 2010 · :flask-logo: Flask Creator
The downside of the decorators is, that you have to import all the views before the server runs for the registration to kick in. The advantage is that the URL rule is closer to the function.
defnull 1 points · Mar 2010 · bottle.py
In bottle, you can add new routes at any time, even from within a callback while the server is running. If you want to define your callbacks first and add the routes later, you can use the decorator as a normal function:
It is possible to simulate the web.py or django behavior (routes stored in a list) with import and a simple a for-loop, if you really want that.
mitsuhiko 2 points · Mar 2010 · :flask-logo: Flask Creator
Obviously that will work. However, that is completely irrelevant to the discussion decorator or explicit mapping. One can easily be converted to the other.