--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/utils.py Mon Feb 09 00:24:13 2009 +0200
@@ -0,0 +1,28 @@
+"""
+ Miscellaneous things
+"""
+
+import datetime
+
+class Date (object) :
+ """
+ Handle dates in URLs as datetime objects (with indeterminate time info) in some timezone
+ """
+
+ def __init__ (self, tz, date_fmt="%Y-%m-%d") :
+ """
+ Format/parse dates in the given timezone using the given format
+ """
+
+ self.tz = tz
+ self.date_fmt = date_fmt
+
+ __name__ = "date"
+
+ def __call__ (self, date_str) :
+ """
+ Parse the given date string
+ """
+
+ return datetime.datetime.strptime(date_str, self.date_fmt).replace(tzinfo=self.tz)
+