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