Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
9bfa8f92
Commit
9bfa8f92
authored
May 04, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
id_as_reference.py: remove __migrate and duplicated codes.
parent
db77f05f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
28 deletions
+6
-28
product/ERP5Type/id_as_reference.py
product/ERP5Type/id_as_reference.py
+6
-28
No files found.
product/ERP5Type/id_as_reference.py
View file @
9bfa8f92
...
...
@@ -49,22 +49,6 @@ def IdAsReferenceMixin(extra_string, string_type="suffix"):
def
getIdAsReferenceSuffix
():
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
,
'getReference'
)
def
getReference
(
self
,
*
args
):
...
...
@@ -89,20 +73,14 @@ def IdAsReferenceMixin(extra_string, string_type="suffix"):
self
.
__dict__
.
pop
(
'default_reference'
,
None
)
if
string_type
==
"prefix"
:
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"
:
new_id
=
value
+
extra_string
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
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
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'setReference'
)
setReference
=
_setReference
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment