restore 3.5 compat for date functions moved to lgc.date in 3.6 (closes #716055) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 23 Feb 2010 09:52:38 +0100
branchstable
changeset 4652 7c41eea7fc30
parent 4651 f9cd35dece09
child 4653 ca11228a5268
restore 3.5 compat for date functions moved to lgc.date in 3.6 (closes #716055)
utils.py
--- a/utils.py	Mon Feb 22 19:25:04 2010 +0100
+++ b/utils.py	Tue Feb 23 09:52:38 2010 +0100
@@ -328,3 +328,12 @@
                 # we never ever want to fail because of an unknown type,
                 # just return None in those cases.
                 return None
+
+from logilab.common import date
+_THIS_MOD_NS = globals()
+for funcname in ('date_range', 'todate', 'todatetime', 'datetime2ticks',
+                 'days_in_month', 'days_in_year', 'previous_month',
+                 'next_month', 'first_day', 'last_day', 'ustrftime',
+                 'strptime'):
+    msg = '[3.6] %s has been moved to logilab.common.date' % funcname
+    _THIS_MOD_NS[funcname] = deprecated(msg)(getattr(date, funcname))