Skip to content

Commit

Permalink
* Added settings.py file
Browse files Browse the repository at this point in the history
* Wrapped `delete_session_data` in a try block, fixes #132
  • Loading branch information
flashingpumpkin committed Jan 9, 2012
1 parent c102de5 commit 23c8ae0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions socialregistration/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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):
"""
Expand Down
3 changes: 3 additions & 0 deletions socialregistration/settings.py
Original file line number Diff line number Diff line change
@@ -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.