RestfulModel Breaks `hasattr`
jpulec opened this issue · 2 comments
jpulec commented
Describe the bug
The RestfulModel
class is a subclass of dict
, and overrides __getattr__
to call dict.get()
. A side effect of this, is that calling hasattr
on a RestfulModel
class will always return True, for any value. This is because internally hasattr
calls getattr(object, 'attrname')
and only returns False
if an AttributeError
is thrown. Since __getattr__
has been overridden to call dict.get()
an AttributeError
will never be raised.
mrashed-dev commented
@jpulec Thanks for opening this issue, we are taking a look and will update you as soon as we have something!
mrashed-dev commented