You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python's __setattr__ has precedence over descriptors like @property. If you do, you'll get:
File "/python2.7/site-packages/springfield/entity.py", line 203, in __setattr__
raise AttributeError('Field %r not defined.' % name)
Entity needs to be modified to allow properties:
if name in self.__fields__ or isinstance(getattr(self.__class__, name, None), property):
object.__setattr__(self, name, value)
else:
raise AttributeError('Field %r not defined.' % name)
As a workaround, the following can be added to any Entity to support properties:
def __setattr__(self, name, value):
if name not in self.__fields__ and isinstance(getattr(self.__class__, name, None), property):
object.__setattr__(self, name, value)
else:
super(EntityName, self).__setattr__(name, value)
The text was updated successfully, but these errors were encountered:
Python's
__setattr__
has precedence over descriptors like@property
. If you do, you'll get:Entity
needs to be modified to allow properties:As a workaround, the following can be added to any
Entity
to support properties:The text was updated successfully, but these errors were encountered: