2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-24 08:11:52 +00:00

decorator to check if user is logged in if settings.PUBLIC_SITE

This commit is contained in:
Martin Green 2011-05-02 02:13:27 +01:00
parent f178fff0b9
commit 9dd5d2ad16

14
helper/__init__.py Normal file
View File

@ -0,0 +1,14 @@
from django.contrib.auth.decorators import login_required
from django.conf import settings
class login_required_if_public(object):
def __init__(self, f):
if settings.PUBLIC_SITE:
self.f = login_required(f)
else:
self.f = f
def __call__(self, *args, **kwargs):
return self.f(*args, **kwargs)