Commit c9ef1ac6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

IdAsReferenceMixin.getReference() is called even in portal_property_sheets...

IdAsReferenceMixin.getReference() is called even in portal_property_sheets migration, so we need a backward compatibility code here, otherwise we cannot safely update 'somehow migrated' instance.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44449 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a59eecc2
...@@ -31,6 +31,7 @@ from AccessControl import ClassSecurityInfo ...@@ -31,6 +31,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.CMFActivity.Errors import ActivityPendingError from Products.CMFActivity.Errors import ActivityPendingError
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
from Acquisition import aq_base
def IdAsReferenceMixin(suffix): def IdAsReferenceMixin(suffix):
suffix_index = - len(suffix) suffix_index = - len(suffix)
...@@ -71,6 +72,9 @@ def IdAsReferenceMixin(suffix): ...@@ -71,6 +72,9 @@ def IdAsReferenceMixin(suffix):
id = self.id id = self.id
if id[suffix_index:] == suffix: if id[suffix_index:] == suffix:
return id[:suffix_index] return id[:suffix_index]
try:
return self._baseGetReference(*args) return self._baseGetReference(*args)
except AttributeError:
return getattr(aq_base(self), 'default_reference', (args or [None])[0])
return IdAsReferenceMixin return IdAsReferenceMixin
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