#NEWLINE# def __init__( self , name , value , fname = None , filetype = None , filesize = None , quote = url_quote ) : #NEWLINE# #INDENT# self . quote = quote #NEWLINE# self . name = quote ( name ) #NEWLINE# if ( ( value is not None ) and ( not hasattr ( value , 'read' ) ) ) : #NEWLINE# #INDENT# value = self . encode_unreadable_value ( value ) #NEWLINE# self . size = len ( fname ) #NEWLINE# #UNINDENT# self . value = value #NEWLINE# if ( fname is not None ) : #NEWLINE# #INDENT# if isinstance ( fname , unicode ) : #NEWLINE# #INDENT# fname = fname . encode ( 'utf-8' ) . encode ( 'string_escape' ) . replace ( '"' , '\\"' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fname = fname . encode ( 'string_escape' ) . replace ( '"' , '\\"' ) #NEWLINE# #UNINDENT# #UNINDENT# self . fname = fname #NEWLINE# if ( filetype is not None ) : #NEWLINE# #INDENT# filetype = to_bytestring ( filetype ) #NEWLINE# #UNINDENT# self . filetype = filetype #NEWLINE# if ( isinstance ( value , file ) and ( filesize is None ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# value . flush ( ) #NEWLINE# #UNINDENT# except IOError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . size = int ( os . fstat ( value . fileno ( ) ) [ 6 ] ) #NEWLINE# #UNINDENT# self . _encoded_hdr = None #NEWLINE# self . _encoded_bdr = None