X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/42c42960c2dce4500f12dd14a68a10ed4f06abf5..1a94f90243f87a850db25293698b7b48b8854509:/forum/middleware.py?ds=sidebyside diff --git a/forum/middleware.py b/forum/middleware.py index fb0a605..1b6e26b 100644 --- a/forum/middleware.py +++ b/forum/middleware.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- 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 -class ForumMiddleware: - def process_request(self, request): +class ForumMiddleware(object): + @staticmethod + def process_request(request): 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)