fix name error, filter out non empty rset
authorsylvain.thenault@logilab.fr
Wed, 25 Feb 2009 18:39:21 +0100
changeset 958 6053622aae81
parent 957 b1f68f725fe9
child 959 ffe5e1631081
fix name error, filter out non empty rset
web/views/baseviews.py
--- a/web/views/baseviews.py	Wed Feb 25 15:55:39 2009 +0100
+++ b/web/views/baseviews.py	Wed Feb 25 18:39:21 2009 +0100
@@ -11,6 +11,8 @@
 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 """
+from __future__ import with_statement
+
 __docformat__ = "restructuredtext en"
 
 from warnings import warn
@@ -243,9 +245,11 @@
         non-meta in a first step, meta in a second step
         """
         if hasattr(self, 'get_side_boxes_defs'):
-            if rset:
+            sideboxes = [(label, rset) for label, rset in self.get_side_boxes_defs(entity)
+                         if rset]
+            if sideboxes:
                 self.w(u'<table width="100%">')
-                for label, rset in self.get_side_boxes_defs(entity):
+                for label, rset in sideboxes:
                     self.w(u'<tr><td>')
                     self.w(u'<div class="sideRelated">')
                     self.wview('sidebox', rset, title=label)