heynemann / motorengine

Motorengine is a port of MongoEngine for Tornado.
http://motorengine.readthedocs.org
204 stars 67 forks source link

AttributeError when using a DynamicField #72

Closed FPurchess closed 5 years ago

FPurchess commented 10 years ago

Using a dynamic field leads to an attribute error on initalization. Here's a sample code:

from motorengine import *
from motorengine.fields.dynamic_field import DynamicField

class MyDocument(document):
    myfield = DynamicField()

leads to

[...]
"/workspace/documents.py" line 1, in <module>
    class MyDocument(Document):
"/lib/python2.7/site-packages/motorengine/metaclasses.py", line 36, in __new__
    attr_value.name = attr_name
AttributeError: can't set attribute
FPurchess commented 10 years ago

corresponding test https://github.com/heynemann/motorengine/pull/73