Ravi Nori has uploaded a new change for review. Change subject: sdk: Add support for filtering kwargs on collection based properties ......................................................................
sdk: Add support for filtering kwargs on collection based properties Enable filtering of results on restrictions for collections Change-Id: I6bc675ce9653b67396f21dd1726726294dc517d9 Bug-Url: https://bugzilla.redhat.com/902976 Signed-off-by: Ravi Nori <[email protected]> --- M src/ovirtsdk/utils/searchhelper.py 1 file changed, 14 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-sdk refs/changes/46/26546/1 diff --git a/src/ovirtsdk/utils/searchhelper.py b/src/ovirtsdk/utils/searchhelper.py index 0a40523..ea2d439 100644 --- a/src/ovirtsdk/utils/searchhelper.py +++ b/src/ovirtsdk/utils/searchhelper.py @@ -53,9 +53,22 @@ for attr, match in compiled: value = res for at in attr: - value = getattr(value, at, None) + if type(value) is list: + values = [] + for val in value: + val = getattr(val, at, None) + if value is not None: + values.append(val) + value = values + else: + value = getattr(value, at, None) if value is None: break + if type(value) is list: + for val in value: + if hasattr(match, 'match') and (val is not None and match.match(str(val))): + matched.append(res) + break if not hasattr(match, 'match') and value != match: break if hasattr(match, 'match') and (value is None or not match.match(str(value))): -- To view, visit http://gerrit.ovirt.org/26546 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6bc675ce9653b67396f21dd1726726294dc517d9 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-sdk Gerrit-Branch: master Gerrit-Owner: Ravi Nori <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
