diff options
author | luxagraf <sng@luxagraf.net> | 2012-09-22 22:27:04 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2012-09-22 22:27:04 -0400 |
commit | efb623af0bcb47d510501c282e1326b11343a29c (patch) | |
tree | 3a35fb19f5eba3b219c65277a5fb712cbe9604ac /lib/filebrowser/decorators.py | |
parent | 0b481fd7931c2ae20ca21f89a87f2ba6a6c01e10 (diff) |
site reorg
Diffstat (limited to 'lib/filebrowser/decorators.py')
-rw-r--r-- | lib/filebrowser/decorators.py | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/filebrowser/decorators.py b/lib/filebrowser/decorators.py deleted file mode 100644 index de80f3d..0000000 --- a/lib/filebrowser/decorators.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding: utf-8 - -# django imports -from django.contrib.sessions.models import Session -from django.shortcuts import get_object_or_404, render_to_response -from django.contrib.auth.models import User -from django.template import RequestContext -from django.conf import settings - - -def flash_login_required(function): - """ - Decorator to recognize a user by its session. - Used for Flash-Uploading. - """ - - def decorator(request, *args, **kwargs): - try: - engine = __import__(settings.SESSION_ENGINE, {}, {}, ['']) - except: - 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'] - # 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) - return decorator - - |