Commit 9bfa8f92 authored by wenjie.zheng's avatar wenjie.zheng Committed by Sebastien Robin

id_as_reference.py: remove __migrate and duplicated codes.

parent db77f05f
...@@ -49,22 +49,6 @@ def IdAsReferenceMixin(extra_string, string_type="suffix"): ...@@ -49,22 +49,6 @@ def IdAsReferenceMixin(extra_string, string_type="suffix"):
def getIdAsReferenceSuffix(): def getIdAsReferenceSuffix():
return extra_string return extra_string
def __migrate(self):
if self.id[extra_string_index:] != extra_string:
new_id = self.__dict__.get('default_reference') + extra_string
parent = self.getParentValue()
if parent.has_key(new_id):
LOG("IdAsReferenceMixin", WARNING, "Skipping migration of %r in %r"
" property sheet, due to ID conflict" % (new_id, parent.getId()))
else:
try:
self.setId(new_id)
del self.default_reference
except ActivityPendingError:
LOG("IdAsReferenceMixin", WARNING, "Skipping migration of %r in %r"
" property sheet, due to pending activities" %
(new_id, parent.getId()))
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getReference') 'getReference')
def getReference(self, *args): def getReference(self, *args):
...@@ -89,12 +73,6 @@ def IdAsReferenceMixin(extra_string, string_type="suffix"): ...@@ -89,12 +73,6 @@ def IdAsReferenceMixin(extra_string, string_type="suffix"):
self.__dict__.pop('default_reference', None) self.__dict__.pop('default_reference', None)
if string_type == "prefix": if string_type == "prefix":
new_id = extra_string + value new_id = extra_string + value
if parent.has_key(new_id):
LOG("IdAsReferenceMixin", WARNING, "Skipping adding of %r in %r"
" property sheet, due to ID conflict" % (new_id, parent.getId()))
else:
self.setId(new_id)
self.default_reference = value # to save reference in workflow tool.
elif string_type == "suffix": elif string_type == "suffix":
new_id = value + extra_string new_id = value + extra_string
if parent.has_key(new_id): if parent.has_key(new_id):
......
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