#NEWLINE# def pre_validate( self , form ) : #NEWLINE# #INDENT# super ( ImageUploadField , self ) . pre_validate ( form ) #NEWLINE# if self . _is_uploaded_file ( self . data ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . image = Image . open ( self . data ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# raise ValidationError ( ( 'Invalid image: %s' % e ) )