From a108af5cb8d864fbc546f6c720f958017283d4ff Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 2 Dec 2013 11:25:25 +0100 Subject: [PATCH] [FIX] website: endpoint_is_enumerable old version of @website.route would wrap the base method within a decorator, and endpoint_is_enumerable had to dig into the decorator to get the original function (and be able to inspect it). @website.route has been simplified and no longer wraps the function, just adds a pair of attributes to it (and so does the base @http.route), so don't dig into anymore, inspect rule.endpoint directly. bzr revid: xmo@openerp.com-20131202102525-8jsondrr1649c8t8 --- addons/website/models/website.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 44fa40d5b9c..29d0efe64da 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -299,16 +299,7 @@ class website(osv.osv): :type rule: werkzeug.routing.Rule :rtype: bool """ - - # apparently the decorator package makes getargspec work correctly - # on functions it decorates. That's not the case for - # @functools.wraps, so hack around to get the original function - # (and hope a single decorator was applied or we're hosed) - # FIXME: this is going to blow up if we want/need to use multiple @route (with various configurations) on a method - undecorated_func = rule.endpoint.func_closure[0].cell_contents - - # If this is ever ported to py3, use signatures, it doesn't suck as much - spec = inspect.getargspec(undecorated_func) + spec = inspect.getargspec(rule.endpoint) # if *args bail the fuck out, only dragons can live there if spec.varargs: