backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 16 Nov 2011 22:07:51 +0100
changeset 8087 dc788369d35f
parent 8084 e22c17e1710d (current diff)
parent 8086 a057a0a4371b (diff)
child 8088 145c0701bac6
backport stable
rset.py
test/unittest_rset.py
--- a/rset.py	Tue Nov 15 22:23:14 2011 +0100
+++ b/rset.py	Wed Nov 16 22:07:51 2011 +0100
@@ -695,7 +695,7 @@
             continue
         if rootvar.name == rootmainvar.name:
             continue
-        if select is not rootselect:
+        if select is not rootselect and isinstance(rootvar, nodes.ColumnAlias):
             term = select.selection[root.subquery_selection_index(select, i)]
         var = _get_variable(term)
         if var is None:
--- a/test/unittest_rset.py	Tue Nov 15 22:23:14 2011 +0100
+++ b/test/unittest_rset.py	Wed Nov 16 22:07:51 2011 +0100
@@ -71,6 +71,13 @@
         result = list(attr_desc_iterator(select, col, 2))
         self.assertEqual(result, [])
 
+    def test_subquery_callfunc_2(self):
+        rql = ('Any X,S,L WHERE X in_state S WITH X, L BEING (Any X,MAX(L) GROUPBY X WHERE X is CWUser, T wf_info_for X, T creation_date L)')
+        rqlst = parse(rql)
+        select, col = rqlst.locate_subquery(0, 'CWUser', None)
+        result = list(attr_desc_iterator(select, col, 0))
+        self.assertEqual(result, [(1, 'in_state', 'subject')])
+
 
 class ResultSetTC(CubicWebTC):
 
@@ -479,5 +486,6 @@
         self.assertIsInstance(str(rset), basestring)
         self.assertEqual(len(str(rset).splitlines()), 1)
 
+
 if __name__ == '__main__':
     unittest_main()
--- a/web/views/reledit.py	Tue Nov 15 22:23:14 2011 +0100
+++ b/web/views/reledit.py	Wed Nov 16 22:07:51 2011 +0100
@@ -176,6 +176,8 @@
                     self._cw, rschema.type, role)
             else:
                 default = self._cw._('<not specified>')
+        else:
+            default = self._cw._(default)
         return xml_escape(default)
 
     def _is_composite(self):