Commit 50b981b5 authored by Jérome Perrin's avatar Jérome Perrin

BTreeFolder2: do not patch manage_delAllObjects on Zope2

On Zope2 this method does not exist and this caused a test failure

======================================================================
FAIL: test_method_protection (testSecurity.TestSecurity)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "parts/erp5/Products/ERP5/tests/testSecurity.py", line 110, in test_method_protection
    self.fail(message)
AssertionError:
The following 1 methods have a docstring but have no security assertions.
	parts/erp5/product/ERP5Type/patches/BTreeFolder2.py:111 manage_delAllObjects
parent a0b89f5d
Pipeline #28384 failed with stage
in 0 seconds
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
############################################################################## ##############################################################################
# Stribger repair of BTreeFolder2 # Stribger repair of BTreeFolder2
from Products.ERP5Type import IS_ZOPE2
from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2Base from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2Base
from Acquisition import aq_base from Acquisition import aq_base
from BTrees.OOBTree import OOBTree from BTrees.OOBTree import OOBTree
...@@ -108,11 +109,12 @@ try: ...@@ -108,11 +109,12 @@ try:
except AttributeError: except AttributeError:
pass pass
def manage_delAllObjects(self, REQUEST=None): if not IS_ZOPE2:
"""Disable dangerous method""" def manage_delAllObjects(self, REQUEST=None):
raise RuntimeError( """Disable dangerous method"""
"manage_delAllObjects is disabled in ERP5 to protect data from " raise RuntimeError(
"human error. There are unbelievable mistakes. ERP5 is a place " "manage_delAllObjects is disabled in ERP5 to protect data from "
"to store important data that must not be deleted easily.") "human error. There are unbelievable mistakes. ERP5 is a place "
"to store important data that must not be deleted easily.")
BTreeFolder2Base.manage_delAllObjects = manage_delAllObjects BTreeFolder2Base.manage_delAllObjects = manage_delAllObjects
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