From 94e3de4b836787a8af1b242e045d897e1bea82ab Mon Sep 17 00:00:00 2001 From: Őry Máté <ory.mate@cloud.bme.hu> Date: Fri, 6 Jun 2014 12:56:32 +0200 Subject: [PATCH] dashboard: refactor GroupCodeMixin --- circle/dashboard/views.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/circle/dashboard/views.py b/circle/dashboard/views.py index 2e445c5..3e7ec30 100644 --- a/circle/dashboard/views.py +++ b/circle/dashboard/views.py @@ -17,6 +17,7 @@ from __future__ import unicode_literals, absolute_import +from itertools import chain from os import getenv import json import logging @@ -108,13 +109,8 @@ class GroupCodeMixin(object): attributes = identity[0] owneratrs = getattr( settings, 'SAML_GROUP_OWNER_ATTRIBUTES', []) - groups = [] - for i in owneratrs: - try: - groups += attributes[i] - except KeyError: - pass - for group in groups: + for group in chain(*[attributes[i] + for i in owneratrs if i in attributes]): try: GroupProfile.search(group) except Group.DoesNotExist: -- libgit2 0.26.0