rset.py
changeset 7397 6a9e66d788b3
parent 7285 39437617f3f0
parent 7395 09ffcc04bd21
child 7595 83872394b5d9
equal deleted inserted replaced
7392:230f2511ad28 7397:6a9e66d788b3
     1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    77         rows = self.rows
    77         rows = self.rows
    78         if len(rows) > 10:
    78         if len(rows) > 10:
    79             rows = rows[:10] + ['...']
    79             rows = rows[:10] + ['...']
    80         if len(rows) > 1:
    80         if len(rows) > 1:
    81             # add a line break before first entity if more that one.
    81             # add a line break before first entity if more that one.
    82             pattern = '<resultset %r (%s rows):\n%s>' 
    82             pattern = '<resultset %r (%s rows):\n%s>'
    83         else:
    83         else:
    84             pattern = '<resultset %r (%s rows): %s>'
    84             pattern = '<resultset %r (%s rows): %s>'
    85 
    85 
    86         if not self.description:
    86         if not self.description:
    87             return pattern % (self.rql, len(self.rows),
    87             return pattern % (self.rql, len(self.rows),
   685     rootmainvar = _get_variable(rootmain)
   685     rootmainvar = _get_variable(rootmain)
   686     assert rootmainvar
   686     assert rootmainvar
   687     root = rootselect.parent
   687     root = rootselect.parent
   688     selectmain = select.selection[selectidx]
   688     selectmain = select.selection[selectidx]
   689     for i, term in enumerate(rootselect.selection):
   689     for i, term in enumerate(rootselect.selection):
   690         rootvar = _get_variable(term)
   690         try:
   691         if rootvar is None:
   691             # don't use _get_variable here: if the term isn't a variable
       
   692             # (function...), we don't want it to be used as an entity attribute
       
   693             # or relation's value (XXX beside MAX/MIN trick?)
       
   694             rootvar = term.variable
       
   695         except AttributeError:
   692             continue
   696             continue
   693         if rootvar.name == rootmainvar.name:
   697         if rootvar.name == rootmainvar.name:
   694             continue
   698             continue
   695         if select is not rootselect:
   699         if select is not rootselect:
   696             term = select.selection[root.subquery_selection_index(select, i)]
   700             term = select.selection[root.subquery_selection_index(select, i)]