Commit 4b043b7a80fcc2787d53c83ab8f82f4c9ca616ab
1 parent
0f909e81
Exists in
master
and in
28 other branches
Added code errors for subscription errors
Showing
1 changed file
with
3 additions
and
2 deletions
Show diff stats
colab/accounts/utils/mailman.py
@@ -49,10 +49,11 @@ def unsubscribe(listname, address): | @@ -49,10 +49,11 @@ def unsubscribe(listname, address): | ||
49 | url = get_url(listname) | 49 | url = get_url(listname) |
50 | try: | 50 | try: |
51 | result = requests.delete(url, timeout=TIMEOUT, data={'address': address}) | 51 | result = requests.delete(url, timeout=TIMEOUT, data={'address': address}) |
52 | - return True, '%s: %s' % (listname, result.json()) | 52 | + msg_type, message = MAILMAN_MSGS[result.json()] |
53 | + return msg_type, message % listname | ||
53 | except: | 54 | except: |
54 | LOGGER.exception('Unable to unsubscribe user') | 55 | LOGGER.exception('Unable to unsubscribe user') |
55 | - return False, 'Error: Unable to unsubscribe user' | 56 | + return E, 'Error: Unable to subscribe user' |
56 | 57 | ||
57 | 58 | ||
58 | def update_subscription(address, lists): | 59 | def update_subscription(address, lists): |