@@ -0,0 +1,503 @@
+# -*- coding: utf-8 -*-%0Afrom functools import wraps%0A%0Afrom django.http import HttpResponseRedirect%0Afrom django.http import Http404%0A%0Adef login_needed(login_url=None):%0A    def deco(func):%0A        @wraps(func)%0A        def wrap(request, *args, **kwargs):%0A            if not request.siteuser:%0A                # No login%0A                if login_url:%0A                    return HttpResponseRedirect(login_url)%0A                raise Http404%0A%0A            return func(request, *args, **kwargs)%0A        return wrap

add login_needed decorator