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