--- a/helpers.py Mon Feb 09 06:12:11 2009 +0200
+++ b/helpers.py Mon Feb 09 06:19:12 2009 +0200
@@ -46,15 +46,38 @@
"""
return datetime.date(month.year, month.month, mday)
+
+ def now (self) :
+ """
+ Build current time
+ """
+
+ return self.ctx['timezone'].localize(datetime.datetime.now())
+
+ def today (self) :
+ """
+ Build today's date
+ """
+
+ return self.now().date()
def is_today (self, date) :
"""
- checks if the given date is today
+ Checks if the given date is today
"""
# construct current date
- return date == self.ctx['timezone'].localize(datetime.datetime.now()).date()
+ return date == self.today()
+ def is_this_month (self, month) :
+ """
+ Checks the given month is the current month
+ """
+
+ today = self.today()
+
+ return (month.year == today.year and month.month == today.month)
+
def prev_month_year (self, month) :
"""
Returns the year of the month before the given one