<s> '''<STR_LIT>''' <EOL> from django . conf import settings <EOL> from django . http import HttpResponseRedirect <EOL> from utils import RegexMatcher <EOL> import logging <EOL> logger = logging . getLogger ( "<STR_LIT>" ) <EOL> class SiteLockDown ( RegexMatcher ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> super ( SiteLockDown , self ) . __init__ ( "<STR_LIT>" ) <EOL> def process_request ( self , request ) : <EOL> try : <EOL> request . django_root <EOL> except AttributeError : <EOL> request . django_root = '<STR_LIT>' <EOL> login_url = settings . LOGIN_URL + '<STR_LIT>' % request . path <EOL> if request . path . startswith ( request . django_root ) : <EOL> path = request . path [ len ( request . django_root ) : ] <EOL> else : <EOL> return HttpResponseRedirect ( login_url ) <EOL> if not request . user . is_authenticated ( ) and not ( path == settings . LOGIN_URL or <EOL> self . matches ( path ) <EOL> ) : <EOL> logger . debug ( "<STR_LIT>" % path ) <EOL> return HttpResponseRedirect ( login_url ) <EOL> return None </s>
