Commit 3c9e6966 authored by Łukasz Nowak's avatar Łukasz Nowak

- follow dynamical behaviour of PropertySheetTemplateItem.preinstall and apply

   required magic on genereted result in dynamic method instead of overriding it


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45306 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9973586a
......@@ -3541,10 +3541,18 @@ class PropertySheetTemplateItem(DocumentTemplateItem,
"""
def inner(self, *args, **kw):
if self._is_already_migrated(getattr(self, object_dict_name).keys()):
return getattr(ObjectTemplateItem, method_name)(self, *args, **kw)
result = getattr(ObjectTemplateItem, method_name)(self, *args, **kw)
else:
return getattr(DocumentTemplateItem, method_name)(self, *args, **kw)
result = getattr(DocumentTemplateItem, method_name)(self, *args, **kw)
if method_name == 'preinstall':
old_result = result.copy()
for k, v in old_result.iteritems():
if not k.startswith('portal_property_sheets/'):
# Magical way to have unique path in case of not yet migrated property
# sheets available on preinstall list
k = self._getKey(k)
result[k] = v
return result
return inner
export = _filesystemCompatibilityWrapper('export', '_objects')
......@@ -3700,17 +3708,6 @@ class PropertySheetTemplateItem(DocumentTemplateItem,
kw['remove_object_dict'] = new_remove_dict
ObjectTemplateItem.remove(self, context, **kw)
def preinstall(self, *args, **kwargs):
preinstall_dict = ObjectTemplateItem.preinstall(self, *args, **kwargs)
new_preinstall_dict = dict()
for k, v in preinstall_dict.iteritems():
if not k.startswith('portal_property_sheets/'):
# Magical way to have unique path in case of not yet migrated property
# sheets available on preinstall list
k = self._getKey(k)
new_preinstall_dict[k] = v
return new_preinstall_dict
def install(self, context, **kw):
if not self._perform_migration:
return DocumentTemplateItem.install(self, context, **kw)
......
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