#NEWLINE# def _cookie_from_cookie_tuple( self , tup , request ) : #NEWLINE# #INDENT# ( name , value , standard , rest ) = tup #NEWLINE# domain = standard . get ( 'domain' , Absent ) #NEWLINE# path = standard . get ( 'path' , Absent ) #NEWLINE# port = standard . get ( 'port' , Absent ) #NEWLINE# expires = standard . get ( 'expires' , Absent ) #NEWLINE# version = standard . get ( 'version' , None ) #NEWLINE# if ( version is not None ) : #NEWLINE# #INDENT# version = int ( version ) #NEWLINE# #UNINDENT# secure = standard . get ( 'secure' , False ) #NEWLINE# discard = standard . get ( 'discard' , False ) #NEWLINE# comment = standard . get ( 'comment' , None ) #NEWLINE# comment_url = standard . get ( 'commenturl' , None ) #NEWLINE# if ( ( path is not Absent ) and ( path != '' ) ) : #NEWLINE# #INDENT# path_specified = True #NEWLINE# path = escape_path ( path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# path_specified = False #NEWLINE# path = request_path ( request ) #NEWLINE# i = path . rfind ( '/' ) #NEWLINE# if ( i != ( - 1 ) ) : #NEWLINE# #INDENT# if ( version == 0 ) : #NEWLINE# #INDENT# path = path [ : i ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# path = path [ : ( i + 1 ) ] #NEWLINE# #UNINDENT# #UNINDENT# if ( len ( path ) == 0 ) : #NEWLINE# #INDENT# path = '/' #NEWLINE# #UNINDENT# #UNINDENT# domain_specified = ( domain is not Absent ) #NEWLINE# domain_initial_dot = False #NEWLINE# if domain_specified : #NEWLINE# #INDENT# domain_initial_dot = bool ( domain . startswith ( '.' ) ) #NEWLINE# #UNINDENT# if ( domain is Absent ) : #NEWLINE# #INDENT# ( req_host , erhn ) = eff_request_host ( request ) #NEWLINE# domain = erhn #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not domain . startswith ( '.' ) ) : #NEWLINE# #INDENT# domain = ( '.' + domain ) #NEWLINE# #UNINDENT# #UNINDENT# port_specified = False #NEWLINE# if ( port is not Absent ) : #NEWLINE# #INDENT# if ( port is None ) : #NEWLINE# #INDENT# port = request_port ( request ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# port_specified = True #NEWLINE# port = re . sub ( '\\s+' , '' , port ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# port = None #NEWLINE# #UNINDENT# if ( expires is Absent ) : #NEWLINE# #INDENT# expires = None #NEWLINE# discard = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( expires <= self . _now ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . clear ( domain , path , name ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# _debug ( "Expiring cookie, domain='%s', path='%s', name='%s'" , domain , path , name ) #NEWLINE# return None #NEWLINE# #UNINDENT# #UNINDENT# return Cookie ( version , name , value , port , port_specified , domain , domain_specified , domain_initial_dot , path , path_specified , secure , expires , discard , comment , comment_url , rest )