Hello Ravi Nori,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/26817

to review the following change.

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]>
(cherry picked from commit 6917c3bfe44c996534158b1767bb0e3425547e68)
---
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/17/26817/1

diff --git a/src/ovirtsdk/utils/searchhelper.py 
b/src/ovirtsdk/utils/searchhelper.py
index 0a40523..1a7ea3e 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 one_val in value:
+                             val = getattr(one_val, at, None)
+                             if val 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/26817
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: sdk_3.4
Gerrit-Owner: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to