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...
This commit is contained in:
Jeremie Dokime
2014-05-12 17:41:19 +02:00
parent 7cfa2a54b7
commit f684769638
+1
View File
@@ -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