def owner(self, pet_id):
try:
pet = Pet.nodes.get(**{self.__selection_field__.get("primary"):
str(markupsafe.escape(pet_id))})
if (pet):
current_owner = pet.owner.get()
if (current_owner):
return jsonify(owner=current_owner.to_dict()), 200
else:
return jsonify(errors=["Selected pet has not been adopted yet!"]), 404
else:
return jsonify(errors=["Selected pet does not exists!"]), 404
except:
return jsonify(errors=["An error occurred while processing your request."]), 500
评论列表
文章目录