summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2012-02-01 15:30:32 +0100
committerFlorent Xicluna <florent.xicluna@gmail.com>2012-02-01 15:30:32 +0100
commit228c817c330583a246bca7905fa903eacdea278d (patch)
tree9cfc72968dc40fcc7a09f9b6a9b60f411fbd88c8 /addons/web
parent8abe9402e267b57947bcb1c87fbd59daf7cec188 (diff)
[IMP] faster implementation for Root.find_handler.
bzr revid: florent.xicluna@gmail.com-20120201143032-pshpu4uhvl61nr9z
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/common/http.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/addons/web/common/http.py b/addons/web/common/http.py
index 016aff3754e..eb3f6093691 100644
--- a/addons/web/common/http.py
+++ b/addons/web/common/http.py
@@ -541,17 +541,17 @@ class Root(object):
:returns: a callable matching the path sections, or ``None``
:rtype: ``Controller | None``
"""
- if len(l):
- for i in range(len(l), 0, -1):
- ps = "/" + "/".join(l[0:i])
- if ps in controllers_path:
- c = controllers_path[ps]
- rest = l[i:] or ['index']
- meth = rest[0]
+ if l:
+ ps = '/' + '/'.join(l)
+ meth = 'index'
+ while ps:
+ c = controllers_path.get(ps)
+ if c:
m = getattr(c, meth)
if getattr(m, 'exposed', False):
_logger.debug("Dispatching to %s %s %s", ps, c, meth)
return m
+ ps, _slash, meth = ps.rpartition('/')
return None
class LibException(Exception):