Python Eve Conditional / Bulk Delete -


from nicola's answer here , own testing seems clear eve not support conditional deletes @ resource endpoints.

i know use get: "where={...}" request _ids , _etags of documents delete, , send out series of requests @ each item endpoint delete them if-match header appropriately set each item's _etag:

for each item:     delete: http://localhost:5000/items/<item._id> 

...but avoid sending out multiple http requests if possible.

one solution may predefined database filters, these static filters i'd dynamically filter deletion depending on url parameters. pre-event hooks may solution i'm seeking.

does eve support bulk deletion? , if not, recommended way extend eve's functionality provide conditional and/or bulk deletes?

i added pre-event hook delete, , seems working tests i've run far:

def add_delete_filters(resource, request, lookup):     if 'where' in request.args:         conditions = request.args.getlist('where')         cond_str in conditions:             cond = json.loads(cond_str)             attrib in cond:                 lookup[attrib] = cond[attrib]  app = eve() app.on_pre_delete += add_delete_filters 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -