MongoEngine / eve-mongoengine

An Eve extension for MongoEngine ODM support
Other
39 stars 28 forks source link

PATCH with empty content raises OperationError #3

Closed hellerstanislav closed 10 years ago

hellerstanislav commented 10 years ago

When issuing PATCH request with empty content {}, eve-mongoengine fails with

Traceback (most recent call last):
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/vagrant/workspace/shop-demo/src/magnetpro/server/magnetpro/services/common/base.py", line 549, in catcher
    return func(*args, **kwargs)
  File "/home/vagrant/workspace/shop-demo/src/magnetpro/server/magnetpro/services/common/base.py", line 626, in proxy
    response = view(**request.view_args)
  File "/home/vagrant/workspace/shop-demo/src/magnetpro/server/magnetpro/services/menu.py", line 382, in patch
    current_app.data.update('MenuItem', _id, payload)
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/eve_mongoengine/datalayer.py", line 279, in update
    qry.update_one(write_concern=self._wc(resource), **kwargs)
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/mongoengine/queryset/base.py", line 467, in update_one
    upsert=upsert, multi=False, write_concern=write_concern, **update)
  File "/home/vagrant/.virtualenvs/shop-demo/lib/python2.7/site-packages/mongoengine/queryset/base.py", line 423, in update
    raise OperationError("No update parameters, would remove data")
OperationError: No update parameters, would remove data