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

Change subject: core: support more complex sequence relationships
......................................................................

core: support more complex sequence relationships

perform before/after multiple times to allow list to be synchronized.

Change-Id: I28ca4fdf48f657feaf72c928d61f4f8a5996bad8
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M ChangeLog
M src/otopi/context.py
2 files changed, 32 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/23/13823/1

diff --git a/ChangeLog b/ChangeLog
index 3d096fa..93ae6d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 ????-??-?? - Version 1.0.2
 
+ * core: support more complex sequence relationships.
  * dialog: fix handling of empty string notes.
  * dialog: support tuples for note like list.
 
diff --git a/src/otopi/context.py b/src/otopi/context.py
index 9aaa281..f3075c2 100644
--- a/src/otopi/context.py
+++ b/src/otopi/context.py
@@ -287,6 +287,7 @@
                 except ValueError:
                     return None
 
+            everModified = False
             for limit in range(400):    # boundary
                 modified = False
                 for index, metadata in enumerate(l):
@@ -295,20 +296,46 @@
                         candidateindex is not None and
                         compare(candidateindex, index)
                     ):
-                        l.insert(candidateindex+offset, metadata)
+                        if self.environment[constants.BaseEnv.DEBUG] > 0:
+                            print(
+                                'modifing method location %s' % (
+                                    metadata['method'],
+                                )
+                            )
+                        l.insert(candidateindex + offset, metadata)
                         if candidateindex < index:
-                            del l[index+1]
+                            del l[index + 1]
                         else:
                             del l[index]
                         modified = True
+                        everModified = True
                         break
                 if not modified:
                     break
             if modified:
                 raise RuntimeError(_('Sequence build loop detected'))
+            return everModified
 
-        _doit(tmplist, 'before', operator.lt, min, 0)
-        _doit(tmplist, 'after', operator.gt, max, 1)
+        for x in range(400):
+            modified = False
+            modified = modified or _doit(
+                tmplist,
+                'before',
+                operator.lt,
+                min,
+                0
+            )
+            modified = modified or _doit(
+                tmplist,
+                'after',
+                operator.gt,
+                max,
+                1
+            )
+            if not modified:
+                break
+        if modified:
+            raise RuntimeError(_('Sequence build loop detected'))
 
         sequence = {}
         for m in tmplist:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I28ca4fdf48f657feaf72c928d61f4f8a5996bad8
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: otopi-1.0
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to