Dictionary becomes BaseList in MongoEngine after assignement

I'm using mongoengine 0.9.0

class EntityChange(Document): ... old_data = DictField() new_data = DictField() 

I want to save dict objects into old_data and new_data.

Why are fields becoming BaseList after assignment?

data = {u'int_id': 100500, u'_cls': 'BuildingKind', ...} instance = EntityChange() instance.new_data = data # after that # isinstance(instance, BaseList) is True # isinstance(instance, BaseDict) is False # instance.new_data == ['int_id', 'id', ...] is True. why? 
6

1 Answer

Passing a dict containing _cls or _types triggered a bug in mongoengine.

A fix has been submitted and was merged in versions 0.10.1 and later.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like