devtools/repotest.py
branchstable
changeset 7357 5ad3154a8810
parent 6957 ffda12be2e9f
child 7359 40490b9e0a6e
--- a/devtools/repotest.py	Mon May 02 20:41:46 2011 +0200
+++ b/devtools/repotest.py	Tue May 10 18:50:13 2011 +0200
@@ -371,8 +371,13 @@
 _orig_select_principal = rqlannotation._select_principal
 
 def _select_principal(scope, relations):
+    def sort_key(something):
+        try:
+            return something.r_type
+        except AttributeError:
+            return (something[0].r_type, something[1])
     return _orig_select_principal(scope, relations,
-                                  _sort=lambda rels: sorted(rels, key=lambda x: x.r_type))
+                                  _sort=lambda rels: sorted(rels, key=sort_key))
 
 try:
     from cubicweb.server.msplanner import PartPlanInformation