[facet] don't crash if no title specified on a facet and filtered rset is empty. Closes #2587883 stable
authorKatia Saurfelt <katia.saurfelt@logilab.fr>
Wed, 03 Jul 2013 14:48:34 +0200
branchstable
changeset 9135 d42540bacff4
parent 9134 a5f53b023132
child 9136 eef0388e8fea
[facet] don't crash if no title specified on a facet and filtered rset is empty. Closes #2587883
web/facet.py
--- a/web/facet.py	Wed Jul 03 14:43:21 2013 +0200
+++ b/web/facet.py	Wed Jul 03 14:48:34 2013 +0200
@@ -74,10 +74,11 @@
 
 
 def rtype_facet_title(facet):
-    ptypes = facet.cw_rset.column_types(0)
-    if len(ptypes) == 1:
-        return display_name(facet._cw, facet.rtype, form=facet.role,
-                            context=iter(ptypes).next())
+    if facet.cw_rset:
+        ptypes = facet.cw_rset.column_types(0)
+        if len(ptypes) == 1:
+            return display_name(facet._cw, facet.rtype, form=facet.role,
+                                context=iter(ptypes).next())
     return display_name(facet._cw, facet.rtype, form=facet.role)
 
 def get_facet(req, facetid, select, filtered_variable):