[Erp5-report] r28730 - /erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Sep 1 18:08:37 CEST 2009


Author: jm
Date: Tue Sep  1 18:08:36 2009
New Revision: 28730

URL: http://svn.erp5.org?rev=28730&view=rev
Log:
Do not call 'apply' on an existing 'security' attribute once the class is built

More generally, the 'security' attribute should not be used once the class is
built, because the constructor of classes inherited from SimpleItem deletes it.
This is currently tolerated in ERP5 because there is always CopyContainer that
provides one, but it also means that CopyContainer.security is just a mix of
attributes generated automatically on most classes.

Previous code was equivalent to
  CopyContainer.security.declarePrivate('doSomethingStupid')
  CopyContainer.security.apply(Organisation)
which is nonsense.

Modified:
    erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py

Modified: erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py?rev=28730&r1=28729&r2=28730&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py [utf8] Tue Sep  1 18:08:36 2009
@@ -31,6 +31,7 @@
 import transaction
 from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
 from Products.ERP5Type.Base import _aq_reset
+from AccessControl import ClassSecurityInfo
 from AccessControl.SecurityManagement import newSecurityManager
 import Products.ERP5Type
 
@@ -618,8 +619,9 @@
     # this method, but does not override existing security definition (defined
     # on the class)
     Organisation = Products.ERP5Type.Document.Organisation.Organisation
-    Organisation.security.declarePrivate('doSomethingStupid')
-    Organisation.security.apply(Organisation)
+    security = ClassSecurityInfo()
+    security.declarePrivate('doSomethingStupid')
+    security.apply(Organisation)
 
     self.createInteractionWorkflow()
     self.interaction.setProperties(




More information about the Erp5-report mailing list