Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entities do not play nicely with @property setters: AttributeError #18

Open
six8 opened this issue Mar 13, 2018 · 0 comments
Open

Entities do not play nicely with @property setters: AttributeError #18

six8 opened this issue Mar 13, 2018 · 0 comments

Comments

@six8
Copy link
Collaborator

six8 commented Mar 13, 2018

from springfield import Entity, fields

class TestEntity(Entity):
    foo = fields.StringField()

    @property
    def bar(self):
        return True

    @bar.setter
    def bar(self, value):
        print 'Set bar to %s' % value

e = TestEntity()
print e.bar
e.bar = False
True
Traceback (most recent call last):
  File "/Users/mthornton/Library/Preferences/PyCharm2017.3/scratches/scratch.py", line 16, in <module>
    e.bar = False
  File "/Users/mthornton/Projects/PulseSecure/pulse-one-pycharm/venv/lib/python2.7/site-packages/springfield/entity.py", line 203, in __setattr__
    raise AttributeError('Field %r not defined.' % name)
AttributeError: Field 'bar' not defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant