From be35c17e626b5a0e64ce6e800516cc2610584420 Mon Sep 17 00:00:00 2001 From: deyk Date: Tue, 24 Jan 2012 15:20:10 -0800 Subject: [PATCH] Removed accounts dependency, using a signal instead. --- cas_provider/signals.py | 7 +++++++ cas_provider/views.py | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 cas_provider/signals.py diff --git a/cas_provider/signals.py b/cas_provider/signals.py new file mode 100644 index 0000000..be5e2a9 --- /dev/null +++ b/cas_provider/signals.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +"""cas_provider.signals -- signal definitions for cas_provider +""" +from django import dispatch + + +on_cas_collect_histories = dispatch.Signal(providing_args=["for_email"]) diff --git a/cas_provider/views.py b/cas_provider/views.py index 7204ae2..ff7dcd7 100644 --- a/cas_provider/views.py +++ b/cas_provider/views.py @@ -14,9 +14,7 @@ from models import ServiceTicket from utils import create_service_ticket from exceptions import SameEmailMismatchedPasswords -#FIXME: Remove this dependency -from accounts.models import IdentifierHistory -from django.contrib.auth.models import User +from . import signals __all__ = ['login', 'validate', 'logout'] @@ -139,9 +137,8 @@ def validate(request): username = ticket.user.username ticket.delete() - histories = IdentifierHistory.objects.filter(user__email__iexact=ticket.user.email) - histories = '\n'.join(histories.values_list('identifier', flat=True)) - histories = '%s\n' % histories if histories else '' + results = signals.on_cas_collect_histories.send(sender=validate, for_email=ticket.user.email) + histories = '\n'.join('\n'.join(rs) for rc, rs in results) return HttpResponse("yes\n%s\n%s" % (username, histories)) -- 2.20.1