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
Laurent S
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):
...
@@ -321,10 +321,8 @@ 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
person
=
person_value
else
:
person
=
person_value
to_person_list
.
append
(
person
)
to_person_list
.
append
(
person
)
# prepare low-level arguments if needed.
# prepare low-level arguments if needed.
...
...
product/ERP5/tests/testNotificationTool.py
View file @
7dd06af4
...
@@ -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