cubicweb/pyramid/rest_api.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Fri, 18 Nov 2016 10:28:41 +0100
branch3.24
changeset 11923 acfb9aa4845e
parent 11811 f09efeead7f9
child 11959 ddc05ce75319
permissions -rw-r--r--
[devtools] Make timeout error in qunit tests configurable and use SkipTest in test_jscript.py This is grafted from 87443f279b0f in default branch (got tired of CI failing because of these unreliable tests).

from __future__ import absolute_import


from pyramid.view import view_config
from cubicweb.pyramid.resources import EntityResource, ETypeResource


@view_config(
    route_name='cwentities',
    context=EntityResource,
    request_method='DELETE')
def delete_entity(context, request):
    context.rset.one().cw_delete()
    request.response.status_int = 204
    return request.response


def includeme(config):
    config.add_route(
        'cwentities', '/{etype}/*traverse',
        factory=ETypeResource.from_match('etype'), match_is_etype='etype')
    config.scan(__name__)