MongoEngine/flask-mongoengine — pull request #83 by maackle (2014-03-25 06:14:52+00:00)
Title: python 3 issue with map behavior

`map` returns an iterator instead of a list in Python 3, so if `only` or `exclude` kwargs are passed to `model_form()`, the iterator is consumed before line 241, so by that point `field_names` is no longer what it's supposed to be. The standard way to deal with this is to wrap the iterator in a `list()`, which I did.

I also changed `set` to `list` on two lines because there's no reason or efficiency gain for sets in this case, and it only serves to mix up the ordering of field names as defined in the `Document`-derived class.