devtools/repotest.py
branchstable
changeset 7357 5ad3154a8810
parent 6957 ffda12be2e9f
child 7359 40490b9e0a6e
equal deleted inserted replaced
7354:f627ab500fda 7357:5ad3154a8810
   369 
   369 
   370 from cubicweb.server import rqlannotation
   370 from cubicweb.server import rqlannotation
   371 _orig_select_principal = rqlannotation._select_principal
   371 _orig_select_principal = rqlannotation._select_principal
   372 
   372 
   373 def _select_principal(scope, relations):
   373 def _select_principal(scope, relations):
       
   374     def sort_key(something):
       
   375         try:
       
   376             return something.r_type
       
   377         except AttributeError:
       
   378             return (something[0].r_type, something[1])
   374     return _orig_select_principal(scope, relations,
   379     return _orig_select_principal(scope, relations,
   375                                   _sort=lambda rels: sorted(rels, key=lambda x: x.r_type))
   380                                   _sort=lambda rels: sorted(rels, key=sort_key))
   376 
   381 
   377 try:
   382 try:
   378     from cubicweb.server.msplanner import PartPlanInformation
   383     from cubicweb.server.msplanner import PartPlanInformation
   379 except ImportError:
   384 except ImportError:
   380     class PartPlanInformation(object):
   385     class PartPlanInformation(object):