Skip to content

Commit

Permalink
Join callback lists returned from backends
Browse files Browse the repository at this point in the history
  • Loading branch information
jbittel committed Aug 15, 2016
1 parent 20b8e49 commit b376551
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions mama_cas/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,21 @@ def _is_allowed(attr, *args):


def get_callbacks(service):
callbacks = []
for backend in _get_backends():
try:
callbacks = backend.get_callbacks(service)
callbacks = callbacks + backend.get_callbacks(service)
except AttributeError:
raise NotImplementedError("%s does not implement get_callbacks()" % backend)
if callbacks:
# TODO merge callback dicts?
return callbacks
return []
return callbacks


def get_logout_url(service):
for backend in _get_backends():
try:
logout_url = backend.get_logout_url(service)
return backend.get_logout_url(service)
except AttributeError:
raise NotImplementedError("%s does not implement get_logout_url()" % backend)
if logout_url:
return logout_url
return None


Expand Down

0 comments on commit b376551

Please sign in to comment.