Re: 2.3.3 datetime module

Gregory Bond <[email protected]>
Newsgroups gmane.comp.python.sybase
Message-ID <[email protected]>
I find this:
	!         if DateTime.__name__ == 'datetime':
	!             return DateTime.datetime(
exceeds even my tolerance for ugly hacks.

What about something like this:

try:
    import DateTime
    DT = DateTime.DateTime
except ImportError:
    try:
        import mx.DateTime
        DT = mx.DateTime.DateTime
    except ImportError:
    	try:
     	   import datetime
      	   DT = datetime.datetime
        except ImportError:
           DT = None

    # ...
	if DT and type(val) is DateTimeType:
		row[col] = DT(val.year, val.month + 1, val.day, # ...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.