Commit 76f1b99d authored by Łukasz Nowak's avatar Łukasz Nowak

Avoid storing document on tool object.

parent 49a488e4
...@@ -151,8 +151,8 @@ def responseSupport(anonymous=False): ...@@ -151,8 +151,8 @@ def responseSupport(anonymous=False):
.portal_preferences.getPreferredRestApiV1TokenServerUrl()) .portal_preferences.getPreferredRestApiV1TokenServerUrl())
return self.REQUEST.response return self.REQUEST.response
else: else:
self.person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue()
if self.person is None: if person is None:
transaction.abort() transaction.abort()
LOG('VifibRestApiV1Tool', ERROR, LOG('VifibRestApiV1Tool', ERROR,
'Currenty logged in user %r has no Person document.'% 'Currenty logged in user %r has no Person document.'%
...@@ -161,6 +161,7 @@ def responseSupport(anonymous=False): ...@@ -161,6 +161,7 @@ def responseSupport(anonymous=False):
self.REQUEST.response.setBody(json.dumps({'error': self.REQUEST.response.setBody(json.dumps({'error':
'There is system issue, please try again later.'})) 'There is system issue, please try again later.'}))
return self.REQUEST.response return self.REQUEST.response
self.person_url = person.getRelativeUrl()
return fn(self, *args, **kwargs) return fn(self, *args, **kwargs)
wrapperResponseSupport.__doc__ = fn.__doc__ wrapperResponseSupport.__doc__ = fn.__doc__
return wrapperResponseSupport return wrapperResponseSupport
...@@ -298,7 +299,8 @@ class InstancePublisher(GenericPublisher): ...@@ -298,7 +299,8 @@ class InstancePublisher(GenericPublisher):
request_dict[k_i] = self.jbody[k_j] request_dict[k_i] = self.jbody[k_j]
try: try:
self.person.requestSoftwareInstance(**request_dict) self.restrictedTraverse(self.person_url
).requestSoftwareInstance(**request_dict)
except Exception: except Exception:
transaction.abort() transaction.abort()
LOG('VifibRestApiV1Tool', ERROR, LOG('VifibRestApiV1Tool', ERROR,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment