#NEWLINE# def clean_url( self ) : #NEWLINE# #INDENT# url = self . cleaned_data . get ( 'url' ) #NEWLINE# if ( not filename ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# ( filename , headers ) = urllib . urlretrieve ( url ) #NEWLINE# if ( not mimetypes . guess_all_extensions ( headers . get ( 'Content-Type' ) ) ) : #NEWLINE# #INDENT# raise forms . ValidationError ( _ ( ( 'The file type is invalid: %s' % type ) ) ) #NEWLINE# #UNINDENT# return SimpleUploadedFile ( filename , open ( filename ) . read ( ) , content_type = headers . get ( 'Content-Type' ) )