use last_day tls-sprint
authorsylvain.thenault@logilab.fr
Thu, 30 Apr 2009 17:35:43 +0200
branchtls-sprint
changeset 1620 76680e515334
parent 1619 e4845b54a704
child 1621 6260508f7d71
use last_day
goa/skel/views.py
--- a/goa/skel/views.py	Thu Apr 30 17:35:11 2009 +0200
+++ b/goa/skel/views.py	Thu Apr 30 17:35:43 2009 +0200
@@ -1,7 +1,7 @@
 # custom application views
-from calendar import monthrange
 from datetime import date
 
+from cubicweb.utils import last_day
 from cubicweb.web.views import baseviews, boxes, calendar
 from cubicweb.web.htmlwidgets import BoxLink, BoxWidget
 
@@ -36,7 +36,7 @@
         box = BoxWidget(_('Blog archives'), id=self.id)
         for year, month in blogmonths:
             firstday = date(year, month, 1)
-            lastday = date(year, month, monthrange(year, month)[1])
+            lastday = last_day(firstday)
             rql = ('Any B WHERE B is BlogEntry, B creation_date >= "%s", B creation_date <= "%s"'
                    % (firstday.strftime('%Y-%m-%d'), lastday.strftime('%Y-%m-%d')))
             url = self.build_url(rql=rql)