示例#1
0
    def delete(self, uri=''):
        "For sql queries that start with 'DELETE from ...'"

        # get node...
        (node, rule_kw) = node_from_uri(uri, method=request.method)

        rule_kw.update(node)
        values = rule_kw
        xhr_data = request.get_json()
        if xhr_data:
            values.update(xhr_data)
        values.update(request.form.to_dict(flat=True))
        values.update(request.args.to_dict(flat=True))
        values['method'] = request.method

        # Execute the sql query with the data
        _query(node.get('id'), **values)

        response = make_response('ok', 204)
        return response
示例#2
0
    def delete(self, uri=''):
        "For sql queries that start with 'DELETE from ...'"

        # get node...
        (node, rule_kw) = node_from_uri(uri, method=request.method)

        rule_kw.update( node )
        values = rule_kw
        xhr_data = request.get_json()
        if xhr_data:
            values.update( xhr_data )
        values.update( request.form.to_dict(flat=True) )
        values.update( request.args.to_dict(flat=True) )
        values['method'] = request.method

        # Execute the sql query with the data
        _query(node['id'], **values)

        response = make_response('ok', 204)
        return response
示例#3
0
    def patch(self, uri=''):
        "For sql queries that start with 'UPDATE ...'"

        # get node...
        (node, rule_kw) = node_from_uri(uri, method=request.method)

        rule_kw.update( node )
        values = rule_kw
        xhr_data = request.get_json()
        if xhr_data:
            values.update( xhr_data )
        values.update( request.form.to_dict(flat=True) )
        values.update( request.args.to_dict(flat=True) )
        values['method'] = request.method

        # Execute the sql query with the data
        _query(node.get('id'), **values)
        db.commit()

        response = make_response('ok', 201)
        return response