Commit 25120fff authored by iv's avatar iv

ERP5Workflow: fix wrong string logic when getReference should remove prefix

parent c39da357
...@@ -36,7 +36,7 @@ from Acquisition import aq_base ...@@ -36,7 +36,7 @@ from Acquisition import aq_base
def IdAsReferenceMixin(extra_string, string_type="suffix"): def IdAsReferenceMixin(extra_string, string_type="suffix"):
extra_string_index = -len(extra_string) extra_string_index = len(extra_string)
class IdAsReferenceMixin(object): class IdAsReferenceMixin(object):
# Declarative security # Declarative security
...@@ -56,8 +56,8 @@ def IdAsReferenceMixin(extra_string, string_type="suffix"): ...@@ -56,8 +56,8 @@ def IdAsReferenceMixin(extra_string, string_type="suffix"):
def getReference(self, *args): def getReference(self, *args):
id = self.id id = self.id
if string_type == "suffix": if string_type == "suffix":
if id[extra_string_index:] == extra_string: if id[-extra_string_index:] == extra_string:
return id[:extra_string_index] return id[:-extra_string_index]
try: try:
return self._baseGetReference(*args) return self._baseGetReference(*args)
except AttributeError: except AttributeError:
......
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