#NEWLINE# def validate( self , data , all_data = None ) : #NEWLINE# #INDENT# from PIL import Image #NEWLINE# try : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if isinstance ( data , ( str , unicode ) ) : #NEWLINE# #INDENT# _file = data #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _file = data . file #NEWLINE# #UNINDENT# image = Image . open ( _file ) #NEWLINE# self . result = image #NEWLINE# return True #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# data . file . seek ( 0 )