sort on sortvalue, not dc_title to allow customization
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 11 Feb 2010 12:18:46 +0100
changeset 4552 79f461d7ec37
parent 4551 450804da3ab2
child 4560 23e0632df615
child 4567 bf3453789887
sort on sortvalue, not dc_title to allow customization
web/views/treeview.py
--- a/web/views/treeview.py	Wed Feb 10 16:32:54 2010 +0100
+++ b/web/views/treeview.py	Thu Feb 11 12:18:46 2010 +0100
@@ -59,8 +59,12 @@
             self._init_headers(treeid, toplevel_thru_ajax)
             ulid = ' id="tree-%s"' % treeid
         self.w(u'<ul%s class="%s">' % (ulid, self.css_classes))
+        # XXX force sorting on x.sortvalue() (which return dc_title by default)
+        # we need proper ITree & co specification to avoid this.
+        # (pb when type ambiguity at the other side of the tree relation,
+        # unability to provide generic implementation on eg Folder...)
         for i, entity in enumerate(sorted(self.cw_rset.entities(),
-                                          key=lambda x: x.dc_title())):
+                                          key=lambda x: x.sortvalue())):
             if i+1 < len(self.cw_rset):
                 morekwargs['is_last'] = False
             else: