Skip to content

Commit

Permalink
[#1635] Fix an email_notifications_since bug
Browse files Browse the repository at this point in the history
Fix the error response when ckan.email_notifications_since is an invalid
string.
  • Loading branch information
Sean Hammond committed Dec 17, 2012
1 parent 5654091 commit a3d7f5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ckan/lib/email_notifications.py
Expand Up @@ -54,7 +54,7 @@ def string_to_timedelta(s):
break

if not match:
raise ckan.logic.ParameterError('Not a valid time: {0}'.format(s))
raise logic.ParameterError('Not a valid time: {0}'.format(s))

gd = match.groupdict()
days = int(gd.get('days', '0'))
Expand Down
5 changes: 5 additions & 0 deletions ckan/tests/lib/test_email_notifications.py
Expand Up @@ -7,7 +7,10 @@
'''
import datetime

import nose.tools

import ckan.lib.email_notifications as email_notifications
import ckan.logic as logic


def test_string_to_time_delta():
Expand Down Expand Up @@ -39,3 +42,5 @@ def test_string_to_time_delta():
minutes=23, seconds=34, milliseconds=87, microseconds=465)
assert email_notifications.string_to_timedelta('.123456') == (
datetime.timedelta(milliseconds=123, microseconds=456))
nose.tools.assert_raises(logic.ParameterError,
email_notifications.string_to_timedelta, 'foobar')

0 comments on commit a3d7f5d

Please sign in to comment.