From: alexander s. <a1...@us...> - 2010-09-16 05:06:48
|
Update of /cvsroot/dbfpy/dbfpy/dbfpy In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv7138 Modified Files: header.py Log Message: fromStream: fix century of the last update field Index: header.py =================================================================== RCS file: /cvsroot/dbfpy/dbfpy/dbfpy/header.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** header.py 11 Feb 2007 09:21:28 -0000 1.5 --- header.py 16 Sep 2010 05:06:39 -0000 1.6 *************** *** 7,10 **** --- 7,11 ---- """ """History (most recent first): + 16-sep-2010 [als] fromStream: fix century of the last update field 11-feb-2007 [als] added .ignoreErrors 10-feb-2007 [als] added __getitem__: return field definitions *************** *** 108,114 **** (_cnt, _hdrLen, _recLen) = struct.unpack("<I2H", _data[4:12]) #reserved = _data[12:32] ## create header object _obj = cls(None, _hdrLen, _recLen, _cnt, ord(_data[0]), ! (1900 + ord(_data[1]), ord(_data[2]), ord(_data[3]))) ## append field definitions # position 0 is for the deletion flag --- 109,122 ---- (_cnt, _hdrLen, _recLen) = struct.unpack("<I2H", _data[4:12]) #reserved = _data[12:32] + _year = ord(_data[1]) + if _year < 80: + # dBase II started at 1980. It is quite unlikely + # that actual last update date is before that year. + _year += 2000 + else: + _year += 1900 ## create header object _obj = cls(None, _hdrLen, _recLen, _cnt, ord(_data[0]), ! (_year, ord(_data[2]), ord(_data[3]))) ## append field definitions # position 0 is for the deletion flag |