Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
6c67fada
Commit
6c67fada
authored
Feb 23, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetic: move checkConsistency error messages to class attributes.
parent
2388b36a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
product/ERP5Type/mixin/component.py
product/ERP5Type/mixin/component.py
+19
-11
No files found.
product/ERP5Type/mixin/component.py
View file @
6c67fada
...
...
@@ -143,6 +143,17 @@ class ComponentMixin(PropertyRecordableMixin, Base):
'Reference'
,
'TextDocument'
)
_message_reference_not_set
=
"Reference must be set"
_message_invalid_reference
=
"Reference cannot end with '_version' or "
\
"start with '_' or be equal to find_module or load_module"
_message_version_not_set
=
"Version must be set"
_message_invalid_version
=
"Version cannot start with '_'"
_message_text_content_not_set
=
"No source code"
_message_invalid_text_content
=
"Source code: ${error_message}"
_message_text_content_syntax_error
=
"Syntax error in source code: "
\
"${error_message} (line: ${line_number}, column: ${column_number})"
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'checkConsistency'
)
def
checkConsistency
(
self
,
*
args
,
**
kw
):
"""
...
...
@@ -156,7 +167,7 @@ class ComponentMixin(PropertyRecordableMixin, Base):
error_list
.
append
(
ConsistencyMessage
(
self
,
object_relative_url
,
message
=
"Reference must be set"
,
message
=
self
.
_message_reference_not_set
,
mapping
=
{}))
elif
(
reference
.
endswith
(
'_version'
)
or
...
...
@@ -165,21 +176,19 @@ class ComponentMixin(PropertyRecordableMixin, Base):
error_list
.
append
(
ConsistencyMessage
(
self
,
object_relative_url
,
message
=
"Reference cannot end with '_version' or "
\
"start with '_' or be equal to find_module or "
\
"load_module"
,
message
=
self
.
_message_invalid_reference
,
mapping
=
{}))
version
=
self
.
getVersion
()
if
not
version
:
error_list
.
append
(
ConsistencyMessage
(
self
,
object_relative_url
,
message
=
"Version must be set"
,
message
=
self
.
_message_version_not_set
,
mapping
=
{}))
elif
version
[
0
]
==
'_'
:
error_list
.
append
(
ConsistencyMessage
(
self
,
object_relative_url
,
message
=
"Version cannot start with '_'"
,
message
=
self
.
_message_invalid_version
,
mapping
=
{}))
text_content
=
self
.
getTextContent
()
...
...
@@ -187,7 +196,7 @@ class ComponentMixin(PropertyRecordableMixin, Base):
error_list
.
append
(
ConsistencyMessage
(
self
,
object_relative_url
=
object_relative_url
,
message
=
"No source code"
,
message
=
self
.
_message_text_content_not_set
,
mapping
=
{}))
else
:
message
=
None
...
...
@@ -198,12 +207,11 @@ class ComponentMixin(PropertyRecordableMixin, Base):
line_number
=
e
.
lineno
,
column_number
=
e
.
offset
)
message
=
"Syntax error in source code: ${error_message} "
\
"(line: ${line_number}, column: ${column_number})"
message
=
self
.
_message_text_content_syntax_error
except
Exception
,
e
:
mapping
=
dict
(
error_message
=
str
(
e
))
message
=
"Source code: ${error_message}"
message
=
self
.
_message_invalid_text_content
if
message
:
error_list
.
append
(
...
...
@@ -240,7 +248,7 @@ class ComponentMixin(PropertyRecordableMixin, Base):
"""
current_workflow
=
self
.
workflow_history
[
'component_validation_workflow'
][
-
1
]
return
[
str
(
error
.
getTranslatedMessage
())
for
error
in
current_workflow
[
'error_list'
]
]
for
error
in
current_workflow
.
get
(
'error_list'
,
[])
]
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'load'
)
def
load
(
self
,
namespace_dict
=
{},
validated_only
=
False
,
text_content
=
None
):
...
...
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