Skip to content

Fix for pickle.loads #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2013
Merged

Fix for pickle.loads #342

merged 1 commit into from
Jun 3, 2013

Conversation

wojcikstefan
Copy link
Member

pickle.loads fails on documents without any changed fields:

    body = pickle.loads(base64.b64decode(task['body']))
  File "/usr/lib/python2.7/pickle.py", line 1382, in loads
    return Unpickler(file).load()
  File "/usr/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/lib/python2.7/pickle.py", line 1217, in load_build
    setstate(state)
  File "/home/ubuntu/closeio/venv/src/mongoengine/mongoengine/base/document.py", line 155, in __setstate__
    setattr(self, k, data[k])
KeyError: '_changed_fields'

This PR fixes it.

@amcgregor
Copy link
Contributor

+1

rozza added a commit that referenced this pull request Jun 3, 2013
@rozza rozza merged commit e7da914 into MongoEngine:master Jun 3, 2013
@rozza
Copy link
Contributor

rozza commented Jun 3, 2013

@wojcikstefan thanks - thats embarrassing as I added that for __get_state__ :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants