[Erp5-report] r32812 jm - in /erp5/trunk/products/ERP5: Document/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Feb 19 02:46:28 CET 2010
Author: jm
Date: Fri Feb 19 02:46:28 2010
New Revision: 32812
URL: http://svn.erp5.org?rev=32812&view=rev
Log:
There is no need to create temporary classes for Constraint and PropertySheet
Also make related unit test more strict.
Modified:
erp5/trunk/products/ERP5/Document/BusinessTemplate.py
erp5/trunk/products/ERP5/tests/testBusinessTemplate.py
Modified: erp5/trunk/products/ERP5/Document/BusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessTemplate.py?rev=32812&r1=32811&r2=32812&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Fri Feb 19 02:46:28 2010
@@ -5578,10 +5578,8 @@
# This is required if the BT contains instances of one of these classes.
orig_module_dict = {}
instance_oid_list = []
- for template_type in ('Constraint', 'Document', 'PropertySheet'):
- for template_id in getattr(self,
- 'getTemplate%sIdList' % template_type)():
- module_id = 'Products.ERP5Type.%s.%s' % (template_type, template_id)
+ for template_id in self.getTemplateDocumentIdList():
+ module_id = 'Products.ERP5Type.Document.' + template_id
orig_module_dict[module_id] = sys.modules.get(module_id)
# Always redefine the module, so that 'instance_oid_list' contains
# the full list of oid to remove from pickle cache.
Modified: erp5/trunk/products/ERP5/tests/testBusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testBusinessTemplate.py?rev=32812&r1=32811&r2=32812&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] Fri Feb 19 02:46:28 2010
@@ -5946,11 +5946,10 @@
def test_167_InstanceAndRelatedClassDefinedInSameBT(self):
from Products.ERP5Type.Document.BusinessTemplate import BaseTemplateItem
BaseTemplateItem_removeProperties = BaseTemplateItem.removeProperties
- object_id_list = []
+ marker_list = []
def removeProperties(self, obj):
# Check it works if the object is modified during download.
- object_id_list.append(obj.id)
- obj.title = 'foo'
+ obj.int_index = marker_list.pop()
return obj
SimpleItem_getCopy = SimpleItem._getCopy
try:
@@ -5960,15 +5959,16 @@
bt_path = os.path.join(os.path.dirname(__file__), 'test_data',
self._testMethodName)
for i in xrange(6):
+ marker_list.append(i)
gc.disable()
bt = template_tool.download(bt_path)
- assert object_id_list.pop() == 'some_file' and not object_id_list
+ assert not marker_list
if i in (2, 4, 5):
transaction.commit()
self.tic()
bt.install(force=1)
gc.enable()
- assert not object_id_list
+ self.assertEqual(self.portal.some_file.int_index, i)
transaction.commit()
self.tic()
finally:
More information about the Erp5-report
mailing list