From 4099decea7218657ca1a7f79fd7148e564bc168b Mon Sep 17 00:00:00 2001 From: Charles Oliveira <18oliveira.charles@gmail.com> Date: Wed, 19 Aug 2015 13:00:32 -0400 Subject: [PATCH] Making sure 'lists' is not just a string --- colab/accounts/utils/mailman.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/colab/accounts/utils/mailman.py b/colab/accounts/utils/mailman.py index 949813d..74d3a3a 100644 --- a/colab/accounts/utils/mailman.py +++ b/colab/accounts/utils/mailman.py @@ -75,18 +75,20 @@ def mailing_lists(**kwargs): url = get_url('lists/') try: - lists = requests.get(url, timeout=TIMEOUT, params=kwargs) + lists = requests.get(url, timeout=TIMEOUT, params=kwargs).json() + if not isinstance(lists, (list, tuple)): + raise except: LOGGER.exception('Unable to list mailing lists') return [] if kwargs.get('names_only'): names_only = [] - for l in lists.json(): + for l in lists: names_only.append(l['listname']) return names_only else: - return lists.json() + return lists def is_private_list(name): -- libgit2 0.21.2