Commit b3a66b78 authored by Julien Cristau's avatar Julien Cristau
Browse files

[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.
parent b8180114ecde
......@@ -378,7 +378,7 @@ class Entity(AppObject):
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)
......
......@@ -245,7 +245,7 @@ class EntityTC(CubicWebTC):
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment