#NEWLINE# @ require_storage #NEWLINE# def save_images( name , data , images ) : #NEWLINE# #INDENT# f = ext . storage . save ( name , data ) #NEWLINE# name = f . name . decode ( 'utf-8' ) #NEWLINE# url = f . url . decode ( 'utf-8' ) #NEWLINE# upload = Upload ( name = name , url = url ) #NEWLINE# for ( size , image ) in images . iteritems ( ) : #NEWLINE# #INDENT# imageio = StringIO ( ) #NEWLINE# image . save ( imageio , format = image . ext ) #NEWLINE# f = ext . storage . save ( ( '%s_%s.%s' % ( os . path . splitext ( name ) [ 0 ] , size , image . ext ) ) , imageio ) #NEWLINE# setattr ( upload , ( '%s_name' % size ) , f . name . decode ( 'utf-8' ) ) #NEWLINE# setattr ( upload , ( '%s_url' % size ) , f . url . decode ( 'utf-8' ) ) #NEWLINE# #UNINDENT# ext . db . session . add ( upload ) #NEWLINE# ext . db . session . commit ( )