You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"error_message": "Could not save document (Mod on _id not allowed)", "traceback": "Traceback (most recent call last):
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie/resources.py\", line 201, in wrapper
response = callback(request, *args, **kwargs)
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie/resources.py\", line 441, in dispatch_detail
return self.dispatch('detail', request, **kwargs)
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 390, in dispatch
return self._wrap_request(request, lambda: super(MongoEngineResource, self).dispatch(request_type, request, **kwargs))
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 360, in _wrap_request
return fun()
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 390, in <lambda>
return self._wrap_request(request, lambda: super(MongoEngineResource, self).dispatch(request_type, request, **kwargs))
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie/resources.py\", line 464, in dispatch\n response = method(request, **kwargs)\n\n File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie/resources.py\", line 1431, in put_detail\n updated_bundle = self.obj_update(bundle=bundle, **self.remove_api_resource_names(kwargs))
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 565, in obj_update
return self.save(bundle, skip_errors=skip_errors)
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 582, in save
return super(MongoEngineResource, self).save(bundle, skip_errors)
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/tastypie/resources.py\", line 2253, in save\n bundle.obj.save()
File \"/home/seraf/Sandbox/LISA/lisa/server/web/interface/models.py\", line 29, in save
return super(LisaUser, self).save(*args, **kwargs)
File \"/home/seraf/.virtualenvs/LISA/local/lib/python2.7/site-packages/mongoengine/document.py\", line 296, in save
raise OperationError(message % unicode(err))
OperationError: Could not save document (Mod on _id not allowed)\n"}
So I tried to see why it detected an _id field as changed on my user resource, and not my plugin.
By adding some debug in :
Mongoengine/document.py (line 242)
object_id=doc['_id']
updates, removals=self._delta()
print"====UPDATES/REMOVALS===="printupdatesprintremovals# Need to add shard key to query, or you get an errorselect_dict= {'_id': object_id}
2014-08-21 11:03:38+0200 [HTTPChannel,83,127.0.0.1] ====UPDATES/REMOVALS====
2014-08-21 11:03:38+0200 [HTTPChannel,83,127.0.0.1] {'description.0.description': u'Ce plugin est celui par d\xe9faut int\xe9grant les interactions basiques avec LISA', 'description.1.lang': u'en', 'description.0.lang': u'fr', 'description.1.description': u'This plugin is shipped by default, managing all basic interactions with LISA'}
2014-08-21 11:03:38+0200 [HTTPChannel,83,127.0.0.1] {'id': 1}
2014-08-21 11:03:38+0200 [-] "127.0.0.1" - - [21/Aug/2014:09:03:38 +0000] "PUT /backend/api/v1/plugin/53dba55aa9a7bf3c9da33373/?format=json HTTP/1.1" 204 - "http://lisa:8000/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/36.0.1985.125 Chrome/36.0.1985.125 Safari/537.36"
Both sent the id field the same way, and I received the request.body.id identical ...
So I don't understand the difference between them ... It appears there's a problem with the hydrate (or dehydrate) functions, but don't know why ...
If you have an idea ...
Thanks a lot !
The text was updated successfully, but these errors were encountered:
Hello,
I don't know if the issue is related to mongoengine or tastypie, but I have a problem with a PUT.
I use angularjs and RESTangular to create this PUT, but I reproduced by writing my PUT request manually.
When I try to save my user (https://github.com/Seraf/LISA/blob/angularjs/lisa/server/web/weblisa/api/accounts.py#L22), it throw me a :
My user is a custom class : https://github.com/Seraf/LISA/blob/angularjs/lisa/server/web/interface/models.py#L15
So, digging a little bit to understand why it doesn't work, I tried with my plugin resource :
https://github.com/Seraf/LISA/blob/angularjs/lisa/server/web/manageplugins/api.py#L14
And it worked.
So I tried to see why it detected an _id field as changed on my user resource, and not my plugin.
By adding some debug in :
Mongoengine/document.py (line 242)
Here is the ouput with a PUT of my user
User :
Here is a put with my plugin :
Plugin :
Both sent the id field the same way, and I received the request.body.id identical ...
So I don't understand the difference between them ... It appears there's a problem with the hydrate (or dehydrate) functions, but don't know why ...
If you have an idea ...
Thanks a lot !
The text was updated successfully, but these errors were encountered: