Commit 8612f137 authored by Titouan Soulard's avatar Titouan Soulard

erp5_api_style: WIP abort transaction

parent 35a1119d
......@@ -32,6 +32,8 @@ from Acquisition import aq_inner
from zExceptions import NotFound, Unauthorized
from Products.ERP5Type import Permissions
import transaction
from erp5.component.mixin.DocumentExtensibleTraversableMixin import DocumentExtensibleTraversableMixin
from erp5.component.document.WebSection import WebSection
......@@ -97,8 +99,17 @@ class jIOMethod(object):
# Avoid information leak when Unauthorized
del error_context["error_message"]
transaction.abort()
transaction.begin()
try:
# Skin used to allow replacement and because Manager proxy role is needed
self.web_section.ERP5Site_logApiErrorAndReturn(**error_context)
except:
transaction.abort()
return
transaction.commit()
class jIOWebSection(WebSection):
portal_type = "jIO Web Section"
......@@ -121,7 +132,7 @@ class jIOWebSection(WebSection):
section = section.aq_parent
return default
security.declareProtected(Permissions.View, "_bobo_traverse__")
security.declareProtected(Permissions.View, "__bobo_traverse__")
def __bobo_traverse__(self, request, name):
if name in ALLOWED_MODES:
return jIOMethod(name, self)
......
......@@ -45,7 +45,9 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
<tuple>
<string>W:108, 6: No exception type(s) specified (bare-except)</string>
</tuple>
</value>
</item>
<item>
......
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