#NEWLINE# def _get_media_info( media_id , media_type ) : #NEWLINE# #INDENT# 'Returns an image or video along with media format for the image.' #NEWLINE# media_format = None #NEWLINE# if ( media_type == 'image' ) : #NEWLINE# #INDENT# media = get_object_or_404 ( Image , pk = media_id ) #NEWLINE# try : #NEWLINE# #INDENT# media_format = imghdr . what ( media . file . path ) #NEWLINE# #UNINDENT# except UnicodeEncodeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( media_type == 'video' ) : #NEWLINE# #INDENT# media = get_object_or_404 ( Video , pk = media_id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise Http404 #NEWLINE# #UNINDENT# #UNINDENT# return ( media , media_id )