3 from forum.modules import get_modules_script_classes
4 from forum.authentication.base import AuthenticationConsumer, ConsumerTemplateContext
6 class ConsumerAndContext:
7 def __init__(self, id, consumer, context):
9 self._consumer = consumer
12 self.context = context
16 return self._consumer()
19 (re.sub('AuthConsumer$', '', name).lower(), cls) for name, cls
20 in get_modules_script_classes('authentication', AuthenticationConsumer).items()
21 if not re.search('AbstractAuthConsumer$', name)
25 (re.sub('AuthContext$', '', name).lower(), cls) for name, cls
26 in get_modules_script_classes('authentication', ConsumerTemplateContext).items()
29 AUTH_PROVIDERS = dict([
30 (name, ConsumerAndContext(name, consumers[name], contexts[name])) for name in consumers.keys()
35 #todo: probably this don't belong here, also this post_stored routine needs a lot of work
36 user_logged_in = django.dispatch.Signal(providing_args=["user", "old_session"])
37 user_updated = django.dispatch.Signal(providing_args=["instance", "updated_by"])
39 def post_stored_anonymous_content(user,old_session,**kwargs):
40 from forum.models import AnonymousQuestion, AnonymousAnswer
41 aq_list = AnonymousQuestion.objects.filter(session_key = old_session)
42 aa_list = AnonymousAnswer.objects.filter(session_key = old_session)
44 if settings.EMAIL_VALIDATION == 'on':#add user to the record
51 #maybe add pending posts message?
52 else: #just publish the questions
58 user_logged_in.connect(post_stored_anonymous_content)