#NEWLINE# def put_model( self , definition , permissions , model_id = None ) : #NEWLINE# #INDENT# if ( model_id is None ) : #NEWLINE# #INDENT# model_id = self . _generate_id ( key_exist = self . _model_exists ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# doc = self . __get_raw_model ( model_id ) #NEWLINE# #UNINDENT# except backend_exceptions . ModelNotFound : #NEWLINE# #INDENT# doc = { #NEWLINE# #INDENT# '_id' : model_id , #NEWLINE# 'type' : 'definition' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# doc [ 'definition' ] = definition #NEWLINE# doc [ 'permissions' ] = permissions #NEWLINE# ( definition_id , _ ) = self . _db . save ( doc ) #NEWLINE# return definition_id