What is the proper way to convert a DELETE request into an UPDATE?
I am doing something like that:
api_manager.create_api(News,
methods=['GET', 'POST', 'DELETE', 'PUT'],
preprocessors={'DELETE': [pre_delete_news]})
def pre_delete_news(instance_id=None, **kw):
# Set the deleted flag
db.engine.execute("SET delete = True FROM news WHERE id = %d" % instance_id)
# Block the DELETE request by raising an exception
raise ProcessingException(description='Delete successfull', code=418)
This is not very clean, because I raise an exception to force the blocking of the delete request.