Commit 9acafb945c5f796bd3f1d9cd0fda73b05a9dfc65
1 parent
b086563a
Exists in
master
and in
28 other branches
Making sure 'lists' is not just a string
Showing
1 changed file
with
5 additions
and
3 deletions
Show diff stats
colab/accounts/utils/mailman.py
| ... | ... | @@ -75,18 +75,20 @@ def mailing_lists(**kwargs): |
| 75 | 75 | url = get_url('lists/') |
| 76 | 76 | |
| 77 | 77 | try: |
| 78 | - lists = requests.get(url, timeout=TIMEOUT, params=kwargs) | |
| 78 | + lists = requests.get(url, timeout=TIMEOUT, params=kwargs).json() | |
| 79 | + if not isinstance(lists, (list, tuple)): | |
| 80 | + raise | |
| 79 | 81 | except: |
| 80 | 82 | LOGGER.exception('Unable to list mailing lists') |
| 81 | 83 | return [] |
| 82 | 84 | |
| 83 | 85 | if kwargs.get('names_only'): |
| 84 | 86 | names_only = [] |
| 85 | - for l in lists.json(): | |
| 87 | + for l in lists: | |
| 86 | 88 | names_only.append(l['listname']) |
| 87 | 89 | return names_only |
| 88 | 90 | else: |
| 89 | - return lists.json() | |
| 91 | + return lists | |
| 90 | 92 | |
| 91 | 93 | |
| 92 | 94 | def is_private_list(name): | ... | ... |