[B] views: fix wrong xhtml when empty rset stable
authorJulien Jehannet <julien.jehannet@logilab.fr>
Wed, 28 Oct 2009 12:19:01 +0100
branchstable
changeset 3794 c741061d5348
parent 3793 ab776b2833cb
child 3795 ce6381416a12
[B] views: fix wrong xhtml when empty rset
web/views/baseviews.py
--- a/web/views/baseviews.py	Tue Nov 03 13:54:07 2009 +0100
+++ b/web/views/baseviews.py	Wed Oct 28 12:19:01 2009 +0100
@@ -251,16 +251,17 @@
             listid = u' id="%s"' % listid
         else:
             listid = u''
-        if title:
-            self.w(u'<div%s class="%s"><h4>%s</h4>\n' % (listid, klass or 'section', title))
-            self.w(u'<ul>\n')
-        else:
-            self.w(u'<ul%s class="%s">\n' % (listid, klass or 'section'))
-        for i in xrange(self.rset.rowcount):
-            self.cell_call(row=i, col=0, vid=subvid, **kwargs)
-        self.w(u'</ul>\n')
-        if title:
-            self.w(u'</div>\n')
+        if self.rset.rowcount:
+            if title:
+                self.w(u'<div%s class="%s"><h4>%s</h4>\n' % (listid, klass or 'section', title))
+                self.w(u'<ul>\n')
+            else:
+                self.w(u'<ul%s class="%s">\n' % (listid, klass or 'section'))
+            for i in xrange(self.rset.rowcount):
+                self.cell_call(row=i, col=0, vid=subvid, **kwargs)
+            self.w(u'</ul>\n')
+            if title:
+                self.w(u'</div>\n')
 
     def cell_call(self, row, col=0, vid=None, **kwargs):
         self.w(u'<li>')