Commit c68c992a authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_forge: avoid zodb bloating when generating git xml tree or diff with zodb

parent c283984e
......@@ -58,6 +58,12 @@
from Products.ERP5Type.Document import newTempBase\n
from ZODB.POSException import ConflictError\n
\n
def respond(v):\n
if REQUEST is None:\n
return v\n
REQUEST.RESPONSE.write(v)\n
raise ValueError("Abort Transaction")\n
\n
template_tool = context.getPortalObject().portal_templates\n
\n
if context.getBuildingState() != "built":\n
......@@ -96,7 +102,7 @@ except ConflictError:\n
raise\n
except Exception as e:\n
print(repr(e))\n
return printed\n
return respond(printed)\n
\n
try:\n
installed_bt_for_diff.setId("installed_bt_for_diff")\n
......@@ -113,14 +119,14 @@ except Exception as e:\n
print(repr(e))\n
template_tool.manage_delObjects(ids=[installed_bt_for_diff.getId()])\n
\n
return printed\n
return respond(printed)\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -58,6 +58,12 @@
from Products.ERP5Type.Document import newTempBase\n
from ZODB.POSException import ConflictError\n
\n
def respond(v):\n
if REQUEST is None:\n
return v\n
REQUEST.RESPONSE.write(v)\n
raise ValueError("Abort Transaction")\n
\n
template_tool = context.getPortalObject().portal_templates\n
\n
if context.getBuildingState() != "built":\n
......@@ -95,7 +101,7 @@ except ConflictError:\n
raise\n
except Exception as e:\n
print(repr(e))\n
return printed\n
return respond(printed)\n
\n
try:\n
installed_bt_for_diff.setId("installed_bt_for_diff")\n
......@@ -108,14 +114,14 @@ except Exception as e:\n
print(repr(e))\n
template_tool.manage_delObjects(ids=[installed_bt_for_diff.getId()])\n
\n
return printed\n
return respond(printed)\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -63,6 +63,10 @@ if not root:\n
return \'\'\'<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n
<tree id=\'0\'></tree>\'\'\'\n
\n
if REQUEST is not None: # XXX workaround to prevent zodb bloat (bt build)\n
# This script is mostly used by javascript, we can abort the transaction\n
REQUEST.RESPONSE.write(vcs_tool.treeToXML(root))\n
raise ValueError("Abort transaction")\n
return vcs_tool.treeToXML(root)\n
......@@ -70,7 +74,7 @@ return vcs_tool.treeToXML(root)\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>show_unmodified=False, do_extract=True</string> </value>
<value> <string>show_unmodified=False, do_extract=True, REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
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