merge stable
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Tue, 23 Jun 2009 15:52:52 +0200
branchstable
changeset 2151 d653e4c944d7
parent 2150 746c5e6acd38 (current diff)
parent 2149 6a631ec5cc71 (diff)
child 2152 edec2c9055e5
merge
--- a/web/facet.py	Tue Jun 23 13:55:23 2009 +0200
+++ b/web/facet.py	Tue Jun 23 15:52:52 2009 +0200
@@ -10,7 +10,7 @@
 
 from itertools import chain
 from copy import deepcopy
-from datetime import date
+from datetime import date, datetime
 
 from logilab.mtconverter import html_escape
 
@@ -683,8 +683,15 @@
 
 
 class DateFacetRangeWidget(FacetRangeWidget):
+
     formatter = 'function (value) {return (new Date(parseFloat(value))).strftime(DATE_FMT);}'
+
+    def round_max_value(self, d):
+        'round to upper value to avoid filtering out the max value'
+        return datetime(d.year, d.month, d.day + 1)
+
     def __init__(self, facet, minvalue, maxvalue):
+        maxvalue = self.round_max_value(maxvalue)
         super(DateFacetRangeWidget, self).__init__(facet,
                                                    datetime2ticks(minvalue),
                                                    datetime2ticks(maxvalue))
--- a/web/views/formrenderers.py	Tue Jun 23 13:55:23 2009 +0200
+++ b/web/views/formrenderers.py	Tue Jun 23 15:52:52 2009 +0200
@@ -206,6 +206,8 @@
         w(u'</table>')
 
     def render_buttons(self, w, form):
+        if not form.form_buttons:
+            return
         w(u'<table class="%s">\n<tr>\n' % self.button_bar_class)
         for button in form.form_buttons:
             w(u'<td>%s</td>\n' % button.render(form))