-# coding: utf-8
+# -*- coding: utf-8
from django.contrib.sessions.models import Session
from django.shortcuts import get_object_or_404, render_to_response
Decorator to recognize a user by its session.
Used for Flash-Uploading.
"""
-
+
def decorator(request, *args, **kwargs):
try:
engine = __import__(settings.SESSION_ENGINE, {}, {}, [''])
request.user = get_object_or_404(User, pk=user_id)
return function(request, *args, **kwargs)
return decorator
-
-