diff options
author | Gordon Chung <chungg@ca.ibm.com> | 2013-10-16 13:50:06 -0400 |
---|---|---|
committer | Gordon Chung <chungg@ca.ibm.com> | 2013-10-17 14:17:21 -0400 |
commit | d280b091320ab27a7de1325f1dc895016bb1c7a1 (patch) | |
tree | 28d3700a5c476af8f13c65b2bb17a0da503b78aa /pycadf/resource.py | |
parent | 1f2ec374ea27a6ce4db4009b0a36097286908cef (diff) | |
download | pycadf-d280b091320ab27a7de1325f1dc895016bb1c7a1.tar.gz |
observer and reporter should be valid Resource
- fix observer and reporter attributes to be valid Resource type
- add check that Resource id shortform for initiator and target do
not reference themselves
Fixes: Bug # 1240067
Change-Id: Iab5b6c129d512039073cc8c2ab7b75ac7c819624
Diffstat (limited to 'pycadf/resource.py')
-rw-r--r-- | pycadf/resource.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pycadf/resource.py b/pycadf/resource.py index 879899e..2566bb0 100644 --- a/pycadf/resource.py +++ b/pycadf/resource.py @@ -151,8 +151,8 @@ class Resource(cadftype.CADFAbstractType): # self validate this cadf:Resource type against schema def is_valid(self): - return ( - hasattr(self, RESOURCE_KEYNAME_TYPEURI) and - hasattr(self, RESOURCE_KEYNAME_ID) - ) + return (hasattr(self, RESOURCE_KEYNAME_ID) and + (getattr(self, RESOURCE_KEYNAME_ID) == "target" or + getattr(self, RESOURCE_KEYNAME_ID) == "initiator" or + hasattr(self, RESOURCE_KEYNAME_TYPEURI))) # TODO(mrutkows): validate the Resource's attribute types |