# HG changeset patch # User Julien Cristau # Date 1450457385 -3600 # Node ID bfd11ffa79f71e7b19b5adab682c4f6e846584bd # Parent b8180114ecdee222aed2681cf9fe347f8836268b [entity] don't look at fetch order recursively If fetch_attrs includes relations, stop including the entities on the other side in our sorting. Fixes regression from 73ea636a5562 where we would sort on the target entity before the attribute we wanted if the relation's name sorted before the attribute's. This showed up in the forge/tracker cubes with Version entities being sorted by their State's name in preference to their version number. diff -r b8180114ecde -r bfd11ffa79f7 entity.py --- a/entity.py Mon Dec 21 10:36:08 2015 +0100 +++ b/entity.py Fri Dec 18 17:49:45 2015 +0100 @@ -378,7 +378,7 @@ else: fetchattrs = etypecls.fetch_attrs etypecls._fetch_restrictions(var, select, fetchattrs, - user, ordermethod, visited=visited) + user, None, visited=visited) if ordermethod is not None: try: cmeth = getattr(cls, ordermethod) diff -r b8180114ecde -r bfd11ffa79f7 test/unittest_entity.py --- a/test/unittest_entity.py Mon Dec 21 10:36:08 2015 +0100 +++ b/test/unittest_entity.py Fri Dec 18 17:49:45 2015 +0100 @@ -245,7 +245,7 @@ Personne.fetch_attrs = ('nom', 'prenom', 'travaille') Societe.fetch_attrs = ('nom', 'evaluee') self.assertEqual(Personne.fetch_rql(user), - 'Any X,AA,AB,AC,AD,AE,AF ORDERBY AA,AE DESC ' + 'Any X,AA,AB,AC,AD,AE,AF ORDERBY AA ' 'WHERE X is_instance_of Personne, X nom AA, X prenom AB, X travaille AC?, ' 'AC evaluee AD?, AD modification_date AE, AC nom AF') # testing symmetric relation