Bug with strptime in mxDateTime

Alok Singhal <alok-bYFJunmd+ZV8UrSeD/[email protected]> Mon, 13 Sep 2010 08:41:52 -0700
Newsgroups gmane.comp.python.egenix.user
Message-ID <[email protected]>
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


_______________________________________________________________________
eGenix.com User Mailing List                     http://www.egenix.com/
https://www.egenix.com/mailman/listinfo/egenix-users