summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2012-05-31 01:08:22 -0700
committerMarcel Hellkamp <marc@gsites.de>2012-05-31 01:08:22 -0700
commit5f2afb5d38ec0d18732279abae13ca544b72eb2d (patch)
tree0fab83b6f9720f568aa9af40b2d78802ff1cf80d
parent59434bc9710f61eea50f0e574e649556b7a46ed1 (diff)
parent955e09812cb36f45569ed379bbe95972415d4bdf (diff)
downloadbottle-5f2afb5d38ec0d18732279abae13ca544b72eb2d.tar.gz
Merge pull request #327 from idkfa/patch-1
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)