rset.py
changeset 7397 6a9e66d788b3
parent 7285 39437617f3f0
parent 7395 09ffcc04bd21
child 7595 83872394b5d9
--- a/rset.py	Wed May 18 16:04:47 2011 +0200
+++ b/rset.py	Thu May 19 10:36:26 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -79,7 +79,7 @@
             rows = rows[:10] + ['...']
         if len(rows) > 1:
             # add a line break before first entity if more that one.
-            pattern = '<resultset %r (%s rows):\n%s>' 
+            pattern = '<resultset %r (%s rows):\n%s>'
         else:
             pattern = '<resultset %r (%s rows): %s>'
 
@@ -687,8 +687,12 @@
     root = rootselect.parent
     selectmain = select.selection[selectidx]
     for i, term in enumerate(rootselect.selection):
-        rootvar = _get_variable(term)
-        if rootvar is None:
+        try:
+            # don't use _get_variable here: if the term isn't a variable
+            # (function...), we don't want it to be used as an entity attribute
+            # or relation's value (XXX beside MAX/MIN trick?)
+            rootvar = term.variable
+        except AttributeError:
             continue
         if rootvar.name == rootmainvar.name:
             continue