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
Klaus Wölfel
erp5
Commits
ad12a47e
Commit
ad12a47e
authored
Nov 02, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be stricter when 2 FS Document/Tool have same name
parent
8addd60c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
21 deletions
+7
-21
product/ERP5Type/Utils.py
product/ERP5Type/Utils.py
+7
-21
No files found.
product/ERP5Type/Utils.py
View file @
ad12a47e
...
@@ -963,27 +963,13 @@ def registerDocumentClass(module_name, class_name):
...
@@ -963,27 +963,13 @@ def registerDocumentClass(module_name, class_name):
old_value
=
document_class_registry
.
get
(
class_name
)
old_value
=
document_class_registry
.
get
(
class_name
)
new_value
=
"%s.%s"
%
(
module_name
,
class_name
)
new_value
=
"%s.%s"
%
(
module_name
,
class_name
)
if
old_value
is
not
None
:
if
old_value
:
old_was_erp5
=
old_value
.
startswith
(
'Products.ERP5'
)
if
class_name
==
'CategoryTool'
:
new_is_erp5
=
module_name
.
startswith
(
'Products.ERP5'
)
assert
module_name
==
'Products.CMFCategory.CategoryTool'
LOG
(
'Utils'
,
WARNING
,
conflict
=
True
'Ignoring replacement of %s by %s'
%
(
old_value
,
new_value
))
if
not
old_was_erp5
:
if
new_is_erp5
:
# overwrite the non-erp5 class with the erp5 class
# likely to happen with e.g. CMF Category Tool and ERP5 Category Tool
LOG
(
'Utils'
,
INFO
,
'Replacing non-ERP5 class %s by ERP5 class %s'
%
(
old_value
,
new_value
))
conflict
=
False
elif
not
new_is_erp5
:
# argh, trying to overwrite an existing erp5 class.
LOG
(
'Utils'
,
INFO
,
'Ignoring replacement of ERP5 class %s by non-ERP5 class %s'
%
(
old_value
,
new_value
))
return
return
raise
Exception
(
"Class %s and %s from different products have the "
if
conflict
:
raise
TypeError
(
"Class %s and %s from different products have the "
"same name"
%
(
old_value
,
new_value
))
"same name"
%
(
old_value
,
new_value
))
document_class_registry
[
class_name
]
=
new_value
document_class_registry
[
class_name
]
=
new_value
...
...
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