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
Hardik Juneja
erp5
Commits
7dd06af4
Commit
7dd06af4
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
b81ff0ee
Changes
2
Hide 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 @
7dd06af4
...
...
@@ -321,10 +321,8 @@ class NotificationTool(BaseTool):
person_value
=
catalog_tool
.
getResultValue
(
portal_type
=
portal_type_list
,
reference
=
person
)
if
person_value
is
None
:
# For backward compatibility. I recommend to use ValueError.(yusei)
raise
IndexError
,
"Can't find person document which reference is '%s'"
%
person
else
:
person
=
person_value
raise
ValueError
(
"Can't find person document which reference is '%s'"
%
person
)
person
=
person_value
to_person_list
.
append
(
person
)
# prepare low-level arguments if needed.
...
...
product/ERP5/tests/testNotificationTool.py
View file @
7dd06af4
...
...
@@ -384,11 +384,9 @@ class TestNotificationTool(ERP5TypeTestCase):
sequence_list
.
play
(
self
)
def
test_09_InvalideRecipient
(
self
):
self
.
assertRaises
(
IndexError
,
self
.
portal
.
portal_notifications
.
sendMessage
,
recipient
=
'UnknowUser'
,
subject
=
'Subject'
,
message
=
'Message'
)
with
self
.
assertRaises
(
ValueError
):
self
.
portal
.
portal_notifications
.
sendMessage
(
recipient
=
'UnknowUser'
,
subject
=
'Subject'
,
message
=
'Message'
)
def
stepCheckPersonNotification
(
self
,
sequence
=
None
,
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