Permalink
Browse files

* Added settings.py file

* Wrapped `delete_session_data` in a try block, fixes #132
  • Loading branch information...
1 parent c102de5 commit 23c8ae038da072d1a41a9b8741a42d975a8887c2 @flashingpumpkin committed Jan 9, 2012
Showing with 8 additions and 4 deletions.
  1. +5 −4 socialregistration/mixins.py
  2. +3 −0 socialregistration/settings.py
@@ -5,8 +5,8 @@
from django.utils import importlib
from django.views.generic.base import TemplateResponseMixin
from socialregistration import signals
+from socialregistration.settings import SESSION_KEY
-SESSION_KEY = getattr(settings, 'SOCIALREGISTRATION_SESSION_KEY', 'socialreg:')
class CommonMixin(TemplateResponseMixin):
"""
@@ -187,9 +187,10 @@ def delete_session_data(self, request):
"""
Clear all session data.
"""
- del request.session['%suser' % SESSION_KEY]
- del request.session['%sprofile' % SESSION_KEY]
- del request.session['%sclient' % SESSION_KEY]
+ for key in ['user', 'profile', 'client']:
+ try: del request.session['%s%s' % (SESSION_KEY, key)]
+ except KeyError: pass
+
class SignalMixin(object):
"""
@@ -0,0 +1,3 @@
+from django.conf import settings
+
+SESSION_KEY = getattr(settings, 'SOCIALREGISTRATION_SESSION_KEY', 'socialreg:')

0 comments on commit 23c8ae0

Please sign in to comment.