Files
Pinry/pinry/core/middleware.py

16 lines
519 B
Python
Raw Normal View History

2012-08-01 21:30:18 +00:00
from django.conf import settings
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
class Public(object):
def process_request(self, request):
if settings.PUBLIC == False and not request.user.is_authenticated():
acceptable_paths = [
'/login/',
'/private/',
'/register/',
]
if request.path not in acceptable_paths:
return HttpResponseRedirect(reverse('core:private'))