def pre_get_callback(resource, request, lookup): """ Callback called before a GET request, we can alter the lookup. """ klass = resource_get_model(resource) klass().on_pre_get(request, lookup)
def pre_patch_callback(resource, request, query): """ Callback called just before the normal processing behavior of a PATCH request. """ klass = resource_get_model(resource) klass().on_pre_patch(request, query)
def post_post_callback(resource, request, response): """ Callback called just after a POST request ended. """ # app.logger.info('### post_post({}) request: {}, response: {}' # .format(resource, request, response)) klass = resource_get_model(resource) klass().on_post_post(request, response)
def pre_post_callback(resource, request): """ Callback called just before the normal processing behavior of a POST request. """ klass = resource_get_model(resource) klass().on_pre_post(request)
def updated_callback(resource, item, original): """ Callback called just after updating a resource in mongo. """ # app.logger.debug('### updated_callback({}) {}'.format(resource, items)) klass = resource_get_model(resource) klass().on_updated(item, original)
def inserted_callback(resource, items): """ Callback called just after inserting a resource in mongo. """ # app.logger.debug('### inserted_callback({}) {}'.format(resource, items)) klass = resource_get_model(resource) for item in items: klass().on_inserted(item)