#NEWLINE# def process_request( self , request ) : #NEWLINE# #INDENT# if ( request . is_secure ( ) or settings . DEBUG_SECURE ) : #NEWLINE# #INDENT# engine = import_module ( settings . SESSION_ENGINE ) #NEWLINE# secure_session_key = request . COOKIES . get ( 'secure_session_id' , None ) #NEWLINE# request . secure_session = engine . SessionStore ( engine ) #NEWLINE# if ( secure_session_key is None ) : #NEWLINE# #INDENT# request . secure_session [ 'is_secure' ] = True #NEWLINE# #UNINDENT# secure_session_key = request . secure_session . session_key #NEWLINE# try : #NEWLINE# #INDENT# if request . user . is_authenticated ( ) : #NEWLINE# #INDENT# user = request . user #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# user_session = UserSession . objects . get ( secure_session_key = secure_session_key ) #NEWLINE# user_session . save ( ) #NEWLINE# user = user_session . user #NEWLINE# #UNINDENT# #UNINDENT# except UserSession . DoesNotExist : #NEWLINE# #INDENT# if request . user . is_authenticated ( ) : #NEWLINE# #INDENT# user = request . user #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# username = '' . join ( ( ( '%x' % random . randint ( 0 , 15 ) ) for i in range ( 16 ) ) ) #NEWLINE# user = User . objects . create ( username = username , password = '!' ) #NEWLINE# #UNINDENT# user_session = UserSession . objects . create ( user = user , secure_session_key = secure_session_key , device_name = ' ' . join ( ( request . device . brand_name , request . device . model_name ) ) ) #NEWLINE# #UNINDENT# request . user = user #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# request . secure_session = None