don't overrwrite files from different lessons
[edumed.git] / forum / middleware.py
index fb0a605..1b6e26b 100644 (file)
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 from urllib import urlencode
 
 from django.contrib.auth import REDIRECT_FIELD_NAME
 from urllib import urlencode
 
 from django.contrib.auth import REDIRECT_FIELD_NAME
@@ -6,9 +7,10 @@ from django.core.urlresolvers import reverse
 from django_cas.views import login as cas_login
 
 
 from django_cas.views import login as cas_login
 
 
-class ForumMiddleware:
-    def process_request(self, request):
+class ForumMiddleware(object):
+    @staticmethod
+    def process_request(request):
         if request.path.startswith(reverse('pybb:index')) \
         if request.path.startswith(reverse('pybb:index')) \
-            and (not hasattr(request, 'user') or not request.user.is_authenticated()):
+                and (not hasattr(request, 'user') or not request.user.is_authenticated()):
             params = urlencode({REDIRECT_FIELD_NAME: request.get_full_path()})
             return HttpResponseRedirect(reverse(cas_login) + '?' + params)
             params = urlencode({REDIRECT_FIELD_NAME: request.get_full_path()})
             return HttpResponseRedirect(reverse(cas_login) + '?' + params)