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
Binh
erp5
Commits
cff4d9e5
Commit
cff4d9e5
authored
Feb 20, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly format error message when validating a Component.
parent
4cf40e3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
product/ERP5Type/Core/Component.py
product/ERP5Type/Core/Component.py
+12
-5
No files found.
product/ERP5Type/Core/Component.py
View file @
cff4d9e5
...
@@ -64,7 +64,7 @@ class Component(Base):
...
@@ -64,7 +64,7 @@ class Component(Base):
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'checkConsistency'
)
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'checkConsistency'
)
def
checkConsistency
(
self
,
text_content
=
None
,
*
args
,
**
kw
):
def
checkConsistency
(
self
,
text_content
=
None
,
*
args
,
**
kw
):
"""
"""
XXX-arnau: should probably
in a separate Constraint class
XXX-arnau: should probably
be in a separate Constraint class?
"""
"""
if
text_content
is
None
:
if
text_content
is
None
:
text_content
=
self
.
getTextContent
()
text_content
=
self
.
getTextContent
()
...
@@ -79,15 +79,22 @@ class Component(Base):
...
@@ -79,15 +79,22 @@ class Component(Base):
try
:
try
:
self
.
load
(
text_content
=
text_content
)
self
.
load
(
text_content
=
text_content
)
except
SyntaxError
,
e
:
except
SyntaxError
,
e
:
message
=
"%s (line: %d, column: %d)"
%
(
e
.
msg
,
e
.
lineno
,
e
.
offset
)
mapping
=
dict
(
error_message
=
str
(
e
),
line_number
=
e
.
lineno
,
column_number
=
e
.
offset
)
message
=
"Syntax error in source code: ${error_message} "
\
"(line: ${line_number}, column: ${column_number})"
except
Exception
,
e
:
except
Exception
,
e
:
message
=
str
(
e
)
mapping
=
dict
(
message
=
str
(
e
))
message
=
"Source code: ${error_message}"
if
message
:
if
message
:
return
[
ConsistencyMessage
(
self
,
return
[
ConsistencyMessage
(
self
,
object_relative_url
=
self
.
getRelativeUrl
(),
object_relative_url
=
self
.
getRelativeUrl
(),
message
=
"Source Code: %s"
%
message
,
message
=
message
,
mapping
=
{}
)]
mapping
=
mapping
)]
return
[]
return
[]
...
...
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