MongoEngine/mongoengine — pull request #539 by damoxc (2013-12-16 14:00:47+00:00)
Title: fix for nested MapFields

When using nested MapFields from a document loaded from the database, the
nested dictionaries aren't converted to BaseDict, so changes aren't
marked.

This also changes the way BaseDict's mark things as changed, before they'd mark
the entire dictionary as changed, which may well be undesirable if you have large
dictionaries but are only changing a single field nested at some depth.

This also includes a change when marking a field as changed to ensure that
nested fields aren't included in a $set query if a parent is already marked
as changed. Not sure if this could occur but it prevents breakage if it does.

Mostly looking for comments on this change, happy to fix up / add tests if this looks
good.