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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
erp5
Commits
8cb8d15c
Commit
8cb8d15c
authored
Feb 08, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5/NotificationTool: Raise ValueError when input data is invalid
parent
5e7ad3b7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
product/ERP5/Tool/NotificationTool.py
product/ERP5/Tool/NotificationTool.py
+2
-4
product/ERP5/tests/testNotificationTool.py
product/ERP5/tests/testNotificationTool.py
+3
-5
No files found.
product/ERP5/Tool/NotificationTool.py
View file @
8cb8d15c
...
@@ -321,9 +321,7 @@ class NotificationTool(BaseTool):
...
@@ -321,9 +321,7 @@ class NotificationTool(BaseTool):
person_value
=
catalog_tool
.
getResultValue
(
portal_type
=
portal_type_list
,
person_value
=
catalog_tool
.
getResultValue
(
portal_type
=
portal_type_list
,
reference
=
person
)
reference
=
person
)
if
person_value
is
None
:
if
person_value
is
None
:
# For backward compatibility. I recommend to use ValueError.(yusei)
raise
ValueError
(
"Can't find person document which reference is '%s'"
%
person
)
raise
IndexError
,
"Can't find person document which reference is '%s'"
%
person
else
:
person
=
person_value
person
=
person_value
to_person_list
.
append
(
person
)
to_person_list
.
append
(
person
)
...
...
product/ERP5/tests/testNotificationTool.py
View file @
8cb8d15c
...
@@ -384,11 +384,9 @@ class TestNotificationTool(ERP5TypeTestCase):
...
@@ -384,11 +384,9 @@ class TestNotificationTool(ERP5TypeTestCase):
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
def
test_09_InvalideRecipient
(
self
):
def
test_09_InvalideRecipient
(
self
):
self
.
assertRaises
(
with
self
.
assertRaises
(
ValueError
):
IndexError
,
self
.
portal
.
portal_notifications
.
sendMessage
(
self
.
portal
.
portal_notifications
.
sendMessage
,
recipient
=
'UnknowUser'
,
subject
=
'Subject'
,
message
=
'Message'
)
recipient
=
'UnknowUser'
,
subject
=
'Subject'
,
message
=
'Message'
)
def
stepCheckPersonNotification
(
self
,
sequence
=
None
,
def
stepCheckPersonNotification
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
...
...
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