restore 3.5 compat for date functions moved to lgc.date in 3.6 (closes #716055)

authorSylvain Thénault <sylvain.thenault@logilab.fr>
changeset7c41eea7fc30
branchstable
phasepublic
hiddenno
parent revision#f9cd35dece09 [devtools/fill] fix date generation and its test
child revision#ca11228a5268 import cleanup
files modified by this revision
utils.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1266915158 -3600
# Tue Feb 23 09:52:38 2010 +0100
# Branch stable
# Node ID 7c41eea7fc30421c926f5e29289f77d722fd3fe5
# Parent f9cd35dece0929f3084432f604310f8270693297
restore 3.5 compat for date functions moved to lgc.date in 3.6 (closes #716055)

diff --git a/utils.py b/utils.py
@@ -326,5 +326,14 @@
1                  return JSONEncoder.default(self, obj)
2              except TypeError:
3                  # we never ever want to fail because of an unknown type,
4                  # just return None in those cases.
5                  return None
6 +
7 +from logilab.common import date
8 +_THIS_MOD_NS = globals()
9 +for funcname in ('date_range', 'todate', 'todatetime', 'datetime2ticks',
10 +                 'days_in_month', 'days_in_year', 'previous_month',
11 +                 'next_month', 'first_day', 'last_day', 'ustrftime',
12 +                 'strptime'):
13 +    msg = '[3.6] %s has been moved to logilab.common.date' % funcname
14 +    _THIS_MOD_NS[funcname] = deprecated(msg)(getattr(date, funcname))