drop mx datetime usage
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 05 Feb 2010 09:15:47 +0100
changeset 483 c39da0ebf38a
parent 481 b19683747d74
child 484 a8de3bb314ef
drop mx datetime usage
__init__.py
nodes.py
--- a/__init__.py	Wed Dec 23 08:52:54 2009 +0100
+++ b/__init__.py	Fri Feb 05 09:15:47 2010 +0100
@@ -1,7 +1,7 @@
 """RQL library (implementation independant).
 
 :copyright:
-  2001-2009 `LOGILAB S.A. <http://www.logilab.fr>`_ (Paris, FRANCE),
+  2001-2010 `LOGILAB S.A. <http://www.logilab.fr>`_ (Paris, FRANCE),
   all rights reserved.
 
 :contact:
--- a/nodes.py	Wed Dec 23 08:52:54 2009 +0100
+++ b/nodes.py	Fri Feb 05 09:15:47 2010 +0100
@@ -3,7 +3,7 @@
 This module defines all the nodes we can find in a RQL Syntax tree, except
 root nodes, defined in the `stmts` module.
 
-:copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: General Public License version 2 - http://www.gnu.org/licenses
 """
@@ -23,12 +23,6 @@
                             'String', 'Substitute', 'etype'))
 
 
-# keep using mx DateTime by default for bw compat
-def use_py_datetime():
-    global KEYWORD_MAP
-    KEYWORD_MAP = {'NOW' : datetime.now,
-                   'TODAY': date.today}
-
 ETYPE_PYOBJ_MAP = { bool: 'Boolean',
                     int: 'Int',
                     long: 'Int',
@@ -42,21 +36,14 @@
                     timedelta: 'Interval',
                     }
 
-
-try:
-    from mx.DateTime import DateTimeType, DateTimeDeltaType, today, now
-    KEYWORD_MAP = {'NOW' : now,
-                   'TODAY': today}
-    ETYPE_PYOBJ_MAP[DateTimeType] = 'Datetime'
-    ETYPE_PYOBJ_MAP[DateTimeDeltaType] = 'Datetime'
-except:
-    use_py_datetime()
+KEYWORD_MAP = {'NOW' : datetime.now,
+               'TODAY': date.today}
 
 def etype_from_pyobj(value):
     """guess yams type from python value"""
     # note:
-    # * Password is not selectable so no problem)
-    # * use type(value) and not value.__class__ since mx instances have no
+    # * Password is not selectable so no problem
+    # * use type(value) and not value.__class__ since C instances may have no
     #   __class__ attribute
     return ETYPE_PYOBJ_MAP[type(value)]