def get_by_id(caller_id, farm_id): """ Returns requested Farm. @cmview_user @param_post{farm_id,int} id of the requested Farm @response{dict} Farm.dict property of the requested Farm """ return Farm.get(caller_id, farm_id).dict
def get_by_id(caller_id, farm_id): """ Returns requested Farm. @decoratedby{src.cm.utils.decorators.user_log} @parameter{farm_id,int} id of the requested Farm @response{dict} requested Farm's data \n fields @asreturned{src.cm.database.entities.farm.Farm.get()} """ return Farm.get(caller_id, farm_id).dict
def destroy(caller_id, farm_id): """ Destroys caller's farms with ids listed in data. @decoratedby{src.cm.utils.decorators.user_log} @parameter{data,list} list of destroyed farm's \c id's @response @asreturned{src.cm.manager.farm.utils.destroy()} """ return Farm.destroy([Farm.get(caller_id, farm_id)])
def destroy(caller_id, farm_id): """ Destroys specified caller's farm. @cmview_user @param_post{farm_id,int} destroyed farm's id @response @asreturned{src.cm.manager.farm.utils.destroy()} """ return Farm.destroy([Farm.get(caller_id, farm_id)])
def save_and_shutdown(caller_id, farm_id, name, description): """ Safely saves and shutdowns Farm's Head. @cmview_user @param_post{farm_id,int} @param_post{name,string} @param_post{description,string} @response{src.cm.manager.farm.utils.save_and_shutdown()} """ farm = Farm.get(caller_id, farm_id) if farm.user.id == caller_id: return Farm.save_and_shutdown(farm, name, description) else: raise CMException("farm_save")
def save_and_shutdown(caller_id, farm_id, name, description): """ Saves and shutdowns safely farm's Head. It saves Head to image described in \c data. @decoratedby{src.cm.utils.decorators.user_log} @parameter{farm_id,int} @parameter{data,dict} \n fields @asrequired{src.cm.farm.utils.save_and_shutdown()} @response{src.cm.manager.farm.utils.save_and_shutdown()} """ farm = Farm.get(caller_id, farm_id) if farm.user.id == caller_id: return Farm.save_and_shutdown(farm, name, description) else: raise CMException("farm_save")