[server] Do not use logilab.common.date.strptime in sqlutils
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 30 Oct 2017 09:14:36 +0100
changeset 12220 3ba6016a459c
parent 12219 4b5f1b676366
child 12221 7254c153b5ce
[server] Do not use logilab.common.date.strptime in sqlutils This function is aliased to datetime.datetime.strptime() and exists only for compatibility with Python <= 2.5 which we no longer support.
cubicweb/server/sqlutils.py
--- a/cubicweb/server/sqlutils.py	Mon Oct 30 09:08:35 2017 +0100
+++ b/cubicweb/server/sqlutils.py	Mon Oct 30 09:14:36 2017 +0100
@@ -543,13 +543,11 @@
         return _limit_size(text, maxsize)
     cnx.create_function("TEXT_LIMIT_SIZE", 2, limit_size2)
 
-    from logilab.common.date import strptime
-
     def weekday(ustr):
         try:
-            dt = strptime(ustr, '%Y-%m-%d %H:%M:%S')
+            dt = datetime.strptime(ustr, '%Y-%m-%d %H:%M:%S')
         except:
-            dt = strptime(ustr, '%Y-%m-%d')
+            dt = datetime.strptime(ustr, '%Y-%m-%d')
         # expect sunday to be 1, saturday 7 while weekday method return 0 for
         # monday
         return (dt.weekday() + 1) % 7