Fix sending messages to numeric stream names.

json_to_foo will raise a ValueError if the JSON passed to it is just a
string containing a number, e.g. "1".

Traceback (most recent call last):
  File "/home/tabbott/humbug/zephyr/views.py", line 711, in extract_recipients
    recipients = json_to_list(raw_recipients)
  File "/home/tabbott/humbug/zephyr/decorator.py", line 289, in json_to_list
    return json_to_foo(json, list)
  File "/home/tabbott/humbug/zephyr/decorator.py", line 282, in json_to_foo
    raise ValueError("argument is not a %s" % (type().__class__.__name__))
ValueError: argument is not a list

Fixes #776.

(imported from commit 0c123a610c009eda9004cf0b0b53d60695c4e8d5)
This commit is contained in:
Tim Abbott 2013-02-13 10:25:34 -05:00
parent 678a51c3e6
commit 1612b5c045
1 changed files with 1 additions and 1 deletions

View File

@ -708,7 +708,7 @@ def mit_to_mit(user_profile, email):
def extract_recipients(raw_recipients):
try:
recipients = json_to_list(raw_recipients)
except simplejson.decoder.JSONDecodeError:
except (simplejson.decoder.JSONDecodeError, ValueError):
recipients = [raw_recipients]
# Strip recipients, and then remove any duplicates and any that