Commit 44ecaaba authored by Julien Muchembled's avatar Julien Muchembled

Fix testBusinessTemplate errors

- test_165_checkCopyBuildInstall
- test_167_InstanceAndRelatedClassDefinedInSameBT
- test_168_DocumentUninstallIsEffective (merged into test_167_)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43445 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c4096045
......@@ -1062,6 +1062,14 @@ class ObjectTemplateItem(BaseTemplateItem):
# 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(ObjectTemplateItem):
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(ObjectTemplateItem):
# 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:
......
......@@ -6872,14 +6872,7 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
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))
......
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