[DB-SIG] DCOracle V1.3.2 and Python V2.0

Matthew Vranicar vranicar@fnal.gov
Mon, 05 Feb 2001 11:49:34 -0600


The following method in the DCOracle/dbi.py file, the dbiDate class
needs to be fixed for DCOracle v1_3_2 to be compatible with Python V2.
There are possibly more such bugs, but this was one found in our tests.
The original code did not pass a sequence in as the argument to mktime,
but rather passed in 9 arguments.  Adding the parantheses around the 9
arguments is all that is required.  This is due to the fact that Python
1 ignored this error and treated the 9 arguments as the sequence, while
Python 2's stricter syntax checking catches this error.

The WRONG version for Python v2 compatibility:

    def __float__(self):
        return float(mktime(self.year, self.month, self.day,
                                      self.hour, self.minute,
self.second,
                                      0,0,0))

The RIGHT version:

    def __float__(self):
        return float(mktime((self.year, self.month, self.day,
                                       self.hour, self.minute,
self.second,
                                       0,0,0)))

This message was processed by the mail server on Mon, 5 Feb 2001
11:24:52.