From f6847696380e8e87501a91409eefd3aa73d4c9bd Mon Sep 17 00:00:00 2001 From: Jeremie Dokime Date: Mon, 12 May 2014 17:41:19 +0200 Subject: [PATCH] Fix LOAD() in restful context When you call LOAD() on a controller who has some actions decorates with @request.restful(), it fail with: @request.restful() TypeError: 'NoneType' object is not callable => because LOAD use other_request variable who are a Request but without all methods and therefore without restful method. I've just mock the restful method but I think that the real restful method will be better... --- gluon/compileapp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gluon/compileapp.py b/gluon/compileapp.py index 551f497b..ecbc60e0 100644 --- a/gluon/compileapp.py +++ b/gluon/compileapp.py @@ -211,6 +211,7 @@ def LOAD(c=None, f='index', args=None, vars=None, request.env.path_info other_request.cid = target other_request.env.http_web2py_component_element = target + other_request.restful = lambda: lambda function: lambda *args, **kwargs: function(*args, **kwargs) # Needed when you call LOAD() on a controller who has some actions decorates with @request.restful() other_response.view = '%s/%s.%s' % (c, f, other_request.extension) other_environment = copy.copy(current.globalenv) # NASTY