update to new rql get_description api stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 30 Jun 2009 15:18:07 +0200
branchstable
changeset 2203 efdd3a9f9028
parent 2202 cb374512949f
child 2204 3472c5498478
update to new rql get_description api
common/__init__.py
debian/control
view.py
--- a/common/__init__.py	Tue Jun 30 08:05:57 2009 +0200
+++ b/common/__init__.py	Tue Jun 30 15:18:07 2009 +0200
@@ -18,9 +18,9 @@
     rtype = 'String'
 
     @classmethod
-    def st_description(cls, funcnode):
-        return ', '.join(term.get_description()
-                         for term in iter_funcnode_variables(funcnode))
+    def st_description(cls, funcnode, mainindex, tr):
+        return ', '.join(sorted(term.get_description(mainindex, tr)
+                                for term in iter_funcnode_variables(funcnode)))
 
 register_function(COMMA_JOIN)  # XXX do not expose?
 
@@ -41,8 +41,8 @@
     rtype = 'String'
 
     @classmethod
-    def st_description(cls, funcnode):
-        return funcnode.children[0].get_description()
+    def st_description(cls, funcnode, mainindex, tr):
+        return funcnode.children[0].get_description(mainindex, tr)
 
 register_function(LIMIT_SIZE)
 
--- a/debian/control	Tue Jun 30 08:05:57 2009 +0200
+++ b/debian/control	Tue Jun 30 15:18:07 2009 +0200
@@ -76,7 +76,7 @@
 Package: cubicweb-common
 Architecture: all
 XB-Python-Version: ${python:Versions}
-Depends: ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.6.0), python-logilab-common (>= 0.41.0), python-yams (>= 0.23.0), python-rql (>= 0.22.0)
+Depends: ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.6.0), python-logilab-common (>= 0.41.0), python-yams (>= 0.23.0), python-rql (>= 0.22.1)
 Recommends: python-simpletal (>= 4.0), python-lxml
 Conflicts: cubicweb-core
 Replaces: cubicweb-core
--- a/view.py	Tue Jun 30 08:05:57 2009 +0200
+++ b/view.py	Tue Jun 30 15:18:07 2009 +0200
@@ -369,20 +369,20 @@
 
     category = 'anyrsetview'
 
-    def columns_labels(self, tr=True):
+    def columns_labels(self, mainindex=0, tr=True):
         if tr:
             translate = display_name
         else:
             translate = lambda req, val: val
-        rqlstdescr = self.rset.syntax_tree().get_description()[0] # XXX missing Union support
+        # XXX [0] because of missing Union support
+        rqlstdescr = self.rset.syntax_tree().get_description(mainindex,
+                                                             translate)[0]
         labels = []
-        for colindex, attr in enumerate(rqlstdescr):
+        for colindex, label in enumerate(rqlstdescr):
             # compute column header
-            if colindex == 0 or attr == 'Any': # find a better label
+            if label == 'Any': # find a better label
                 label = ','.join(translate(self.req, et)
                                  for et in self.rset.column_types(colindex))
-            else:
-                label = translate(self.req, attr)
             labels.append(label)
         return labels