summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>2012-05-31 15:49:11 +0800
committer Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>2012-05-31 15:49:11 +0800
commit955e09812cb36f45569ed379bbe95972415d4bdf (patch)
tree0fab83b6f9720f568aa9af40b2d78802ff1cf80d
parent59434bc9710f61eea50f0e574e649556b7a46ed1 (diff)
downloadbottle-955e09812cb36f45569ed379bbe95972415d4bdf.tar.gz
Update docs/routing.rst
-rw-r--r--docs/routing.rst20
1 files changed, 19 insertions, 1 deletions
diff --git a/docs/routing.rst b/docs/routing.rst
index 954412f..f3f0898 100644
--- a/docs/routing.rst
+++ b/docs/routing.rst
@@ -107,5 +107,23 @@ The second route will never hit. Even POST requests don't arrive at the second r
Sounds complicated, and it is. That is the price for performance. It is best to avoid ambiguous routes at all and choose unique prefixes for each route. This implementation detail may change in the future, though. We are working on it.
-
+Explicit routing configuration
+--------------------------------------------------------------------------------
+
+Route decorator can also be directly called as method. This way provides flexibility in complex setups, allowing you to directly control, when and how routing configuration done.
+
+Here is a basic example of explicit routing configuration for default bottle application::
+
+ def setup_routing():
+ bottle.route('/', method='GET', index)
+ bottle.route('/edit', method=['GET', 'POST'], edit)
+
+In fact, any :class:`Bottle` instance routing can be configured same way::
+
+ def setup_routing(app):
+ app.route('/new', method=['GET', 'POST'], form_new)
+ app.route('/edit', method=['GET', 'POST'], form_edit)
+
+ app = Bottle()
+ setup_routing(app)