Permalink
Browse files

supress server error when user tries to upload with expired session

  • Loading branch information...
1 parent 9ca0b36 commit d797cf042308309b2202ca29b0c7fe9149ec8197 @wardi committed Dec 9, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 filebrowser/decorators.py
View
2 filebrowser/decorators.py
@@ -21,7 +21,7 @@ def decorator(request, *args, **kwargs):
import django.contrib.sessions.backends.db
engine = django.contrib.sessions.backends.db
session_data = engine.SessionStore(request.POST.get('session_key'))
- user_id = session_data['_auth_user_id']
+ user_id = session_data.get('_auth_user_id', None)
# will return 404 if the session ID does not resolve to a valid user
request.user = get_object_or_404(User, pk=user_id)
return function(request, *args, **kwargs)

0 comments on commit d797cf0

Please sign in to comment.