From 0867b705347595b0fb58b1ff1cdf8c36c99c5ae2 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 20 Jun 2013 14:18:58 +0200 Subject: [PATCH] Added doc bzr revid: nicolas.vanhoren@openerp.com-20130620121858-mwu5t9t4oxv1w7tw --- addons/web/doc/web_controllers.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/addons/web/doc/web_controllers.rst b/addons/web/doc/web_controllers.rst index 3f30f55b8c0..34655b99674 100644 --- a/addons/web/doc/web_controllers.rst +++ b/addons/web/doc/web_controllers.rst @@ -86,6 +86,30 @@ HTTP methods they receive arguments as named parameters (except these arguments def division(self, i, j): return i / j # returns a number +URL Patterns +------------ + +Any URL passed to ``http.route()`` can contain patterns. Example: + +:: + + @http.route('/files/', type="html") + def files(self, file_path): + ... # return a file identified by the path store in the 'my_path' variable + +When such patterns are used, the method will received additional parameters that correspond to the parameters defined in +the url. For exact documentation about url patterns, see Werkzeug's documentation: +http://werkzeug.pocoo.org/docs/routing/ . + +Also note you can pass multiple urls to ``http.route()``: + + +:: + + @http.route(['/files/', '/other_url/'], type="html") + def files(self, file_path): + ... + Contacting Models -----------------