#NEWLINE# def set_user_cookie( self , environ , userid , tokens , user_data ) : #NEWLINE# #INDENT# if ( not isinstance ( tokens , basestring ) ) : #NEWLINE# #INDENT# tokens = ',' . join ( tokens ) #NEWLINE# #UNINDENT# if self . include_ip : #NEWLINE# #INDENT# remote_addr = environ [ 'REMOTE_ADDR' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# remote_addr = '0.0.0.0' #NEWLINE# #UNINDENT# ticket = AuthTicket ( self . secret , userid , remote_addr , tokens = tokens , user_data = user_data , cookie_name = self . cookie_name , secure = self . secure ) #NEWLINE# cur_domain = environ . get ( 'HTTP_HOST' , environ . get ( 'SERVER_NAME' ) ) #NEWLINE# wild_domain = ( '.' + cur_domain ) #NEWLINE# cookie_options = '' #NEWLINE# if self . secure : #NEWLINE# #INDENT# cookie_options += '; secure' #NEWLINE# #UNINDENT# if self . httponly : #NEWLINE# #INDENT# cookie_options += '; HttpOnly' #NEWLINE# #UNINDENT# cookies = [ ] #NEWLINE# if cur_domain . no_domain_cookie : #NEWLINE# #INDENT# cookies . append ( ( 'Set-Cookie' , ( '%s=%s; Path=/%s' % ( self . cookie_name , ticket . cookie_value ( ) , cookie_options ) ) ) ) #NEWLINE# #UNINDENT# if self . current_domain_cookie : #NEWLINE# #INDENT# cookies . append ( ( 'Set-Cookie' , ( '%s=%s; Path=/; Domain=%s%s' % ( self . cookie_name , ticket . cookie_value ( ) , cur_domain , cookie_options ) ) ) ) #NEWLINE# #UNINDENT# if self . wildcard_cookie : #NEWLINE# #INDENT# cookies . append ( ( 'Set-Cookie' , ( '%s=%s; Path=/; Domain=%s%s' % ( self . cookie_name , ticket . cookie_value ( ) , wild_domain , cookie_options ) ) ) ) #NEWLINE# #UNINDENT# return cookies