Alon Bar-Lev has uploaded a new change for review.

Change subject: core: aggregate correctly multi-value 'after'
......................................................................

core: aggregate correctly multi-value 'after'

Change-Id: I281b22f7cf128cb2dcc2350c725f3d649fa0f7bc
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M src/otopi/context.py
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/81/11781/1

diff --git a/src/otopi/context.py b/src/otopi/context.py
index 1079544..9aaa281 100644
--- a/src/otopi/context.py
+++ b/src/otopi/context.py
@@ -277,10 +277,10 @@
         # Handle before and after
         # KISS mode
         #
-        def _doit(l, what, op, offset):
+        def _doit(l, what, compare, aggregate, offset):
             def _indexOfName(names):
                 try:
-                    return min(
+                    return aggregate(
                         i for i, data in enumerate(l)
                         if data['name'] in names
                     )
@@ -293,7 +293,7 @@
                     candidateindex = _indexOfName(metadata[what])
                     if (
                         candidateindex is not None and
-                        op(candidateindex, index)
+                        compare(candidateindex, index)
                     ):
                         l.insert(candidateindex+offset, metadata)
                         if candidateindex < index:
@@ -307,8 +307,8 @@
             if modified:
                 raise RuntimeError(_('Sequence build loop detected'))
 
-        _doit(tmplist, 'before', operator.lt, 0)
-        _doit(tmplist, 'after', operator.gt, 1)
+        _doit(tmplist, 'before', operator.lt, min, 0)
+        _doit(tmplist, 'after', operator.gt, max, 1)
 
         sequence = {}
         for m in tmplist:


--
To view, visit http://gerrit.ovirt.org/11781
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I281b22f7cf128cb2dcc2350c725f3d649fa0f7bc
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to