[egenix-users] Bug with strptime in mxDateTime

Alok Singhal alok at merfinllc.com
Mon Sep 13 09:41:52 CEST 2010


Hi,

I am using egenix DateTime module, version 3.1.3.  In
mx/DateTime/mxDateTime/__init__.py, there's a check for strptime:

# If strptime() is not available, use the time.strptime() as
# work-around, if that is available
try:
    strptime
    raise NameError
except NameError:
    if hasattr(time, 'strptime'):
        def strptime(string, format,
                     _time=time):
            return DateTime(*_time.strptime(string, format)[:6])

The code in the 'try' clause above raises NameError whether or not the
name 'strptime' exists.  The line

    raise NameError

should not be there.

Thanks,
Alok



More information about the egenix-users mailing list