def delete_message(key): fetch = myBucket.get(key) if (fetch.data is None): abort(404) storedMessage = SimpleMessage.deserialize(fetch.data) fetch.delete() return jsonify({'message': storedMessage.serialize()}), 200
def reply_message(): if not request.json or not ('key' in request.json and 'body' in request.json): abort(400) fetch = myBucket.get(request.json['key']) if (fetch.data is None): abort(404) storedMessage = SimpleMessage.deserialize(fetch.data) replyMessage = storedMessage.reply(request.json['body']) riakObj = store(replyMessage) return jsonify({'key': riakObj.key, 'message': replyMessage.serialize()}), 201