Add in some new settings.

This commit is contained in:
Isaac Bythewood
2012-08-01 21:30:18 +00:00
parent 5854c6dd49
commit f00e106dfe
8 changed files with 64 additions and 5 deletions

15
pinry/core/middleware.py Normal file
View File

@@ -0,0 +1,15 @@
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'))