[Erp5-report] r43445 jm - in /erp5/trunk/products/ERP5: Document/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Feb 17 18:29:23 CET 2011
Author: jm
Date: Thu Feb 17 18:29:23 2011
New Revision: 43445
URL: http://svn.erp5.org?rev=43445&view=rev
Log:
Fix testBusinessTemplate errors
- test_165_checkCopyBuildInstall
- test_167_InstanceAndRelatedClassDefinedInSameBT
- test_168_DocumentUninstallIsEffective (merged into test_167_)
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=43445&r1=43444&r2=43445&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessTemplate.py [utf8] Thu Feb 17 18:29:23 2011
@@ -1062,6 +1062,14 @@ class ObjectTemplateItem(BaseTemplateIte
# install object
obj = self._objects[path]
+ if isinstance(self, PortalTypeTemplateItem):
+ # if that's an old style class, use a portal type class instead
+ # XXX PortalTypeTemplateItem-specific
+ migrateme = getattr(obj, '_migrateToPortalTypeClass', None)
+ if migrateme is not None:
+ migrateme()
+ self._objects[path] = obj
+
# XXX Following code make Python Scripts compile twice, because
# _getCopy returns a copy without the result of the compilation.
# A solution could be to add a specific _getCopy method to
@@ -1947,24 +1955,10 @@ class PortalTypeTemplateItem(ObjectTempl
PersistentMigrationMixin._no_migration -= 1
return object_key_list
+ # XXX : this method is kept temporarily, but can be removed once all bt5 are
+ # re-exported with separated workflow-chain information
def install(self, context, trashbin, **kw):
- if context.getTemplateFormatVersion() == 1:
- object_list = self._objects
- else:
- object_list = self._archive
-
- for path, obj in object_list.iteritems():
- # if that's an old style class, use a portal type class instead
- # XXX PortalTypeTemplateItem-specific
- migrateme = getattr(obj, '_migrateToPortalTypeClass', None)
- if migrateme is not None:
- migrateme()
- object_list[path] = obj
-
ObjectTemplateItem.install(self, context, trashbin, **kw)
-
- # XXX : following be removed once all bt5 are
- # re-exported with separated workflow-chain information
update_dict = kw.get('object_to_update')
force = kw.get('force')
# We now need to setup the list of workflows corresponding to
@@ -1974,6 +1968,10 @@ class PortalTypeTemplateItem(ObjectTempl
# best solution, by default it is 'default_workflow', which is
# not very usefull
default_chain = ''
+ if context.getTemplateFormatVersion() == 1:
+ object_list = self._objects
+ else:
+ object_list = self._archive
for path in object_list.keys():
if update_dict.has_key(path) or force:
if not force:
Modified: erp5/trunk/products/ERP5/tests/testBusinessTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testBusinessTemplate.py?rev=43445&r1=43444&r2=43445&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testBusinessTemplate.py [utf8] Thu Feb 17 18:29:23 2011
@@ -6872,14 +6872,7 @@ class TestBusinessTemplate(ERP5TypeTestC
SimpleItem._getCopy = SimpleItem_getCopy
# check the previously existing instance now behaves as the overriden class
self.assertTrue(getattr(portal.another_file, 'isClassOverriden', False))
-
- def test_168_DocumentUninstallIsEffective(self):
- portal = self.portal
- # Test_167 above needs to have been run
- if not getattr(getattr(portal, 'some_file', None),
- 'isClassOverriden',
- False):
- self.test_167_InstanceAndRelatedClassDefinedInSameBT()
+ # test uninstall is effective
self.uninstallBusinessTemplate('test_bt')
# check both File instances no longer behave like being overriden
self.assertFalse(getattr(portal.another_file, 'isClassOverriden', False))
More information about the Erp5-report
mailing list