You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2019/12/16 18:13:09 UTC
[qpid-dispatch] branch master updated: DISPATCH-1525: raise
AttributeError if accessing invalid Entity attribute
This is an automated email from the ASF dual-hosted git repository.
kgiusti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new ca8c32c DISPATCH-1525: raise AttributeError if accessing invalid Entity attribute
ca8c32c is described below
commit ca8c32c4b106b7c1b41be6c02e767ae3cb0bd57c
Author: Kenneth Giusti <kg...@apache.org>
AuthorDate: Mon Dec 16 12:26:07 2019 -0500
DISPATCH-1525: raise AttributeError if accessing invalid Entity attribute
Using 'hasattr' against the Entity class will not work properly unless
the Entity's __getattr__ method raises an AttributeError when the
attribute is not present.
This closes #646
---
python/qpid_dispatch/management/entity.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/python/qpid_dispatch/management/entity.py b/python/qpid_dispatch/management/entity.py
index 58ba836..a7d703a 100644
--- a/python/qpid_dispatch/management/entity.py
+++ b/python/qpid_dispatch/management/entity.py
@@ -81,7 +81,9 @@ class EntityBase(object):
return self.attributes[name]
def __getattr__(self, name):
- return self.attributes[name]
+ if name in self.attributes:
+ return self.attributes[name]
+ raise AttributeError
def __contains__(self, name):
return name in self.attributes
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org