[Python-checkins] python/dist/src/Lib/bsddb __init__.py,1.14,1.15
greg at users.sourceforge.net
greg at users.sourceforge.net
Sun Jun 27 18:56:45 EDT 2004
Update of /cvsroot/python/python/dist/src/Lib/bsddb
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26632/Lib/bsddb
Modified Files:
__init__.py
Log Message:
Fix SF bug # 897820 - we can no longer use the DB_TRUNCATE flag when
opening the DB to implement legacy interface flag='n' support as
BerkeleyDB 4.2.52 no longer allows it in transaction protected
environments. Do the os.unlink ourselves.
Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/__init__.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** __init__.py 26 Feb 2004 10:07:12 -0000 1.14
--- __init__.py 27 Jun 2004 22:56:42 -0000 1.15
***************
*** 60,64 ****
#----------------------------------------------------------------------
! import sys
# for backwards compatibility with python versions older than 2.3, the
--- 60,64 ----
#----------------------------------------------------------------------
! import sys, os
# for backwards compatibility with python versions older than 2.3, the
***************
*** 282,286 ****
cachesize=None, lorder=None, hflags=0):
! flags = _checkflag(flag)
e = _openDBEnv()
d = db.DB(e)
--- 282,286 ----
cachesize=None, lorder=None, hflags=0):
! flags = _checkflag(flag, file)
e = _openDBEnv()
d = db.DB(e)
***************
*** 300,304 ****
pgsize=None, lorder=None):
! flags = _checkflag(flag)
e = _openDBEnv()
d = db.DB(e)
--- 300,304 ----
pgsize=None, lorder=None):
! flags = _checkflag(flag, file)
e = _openDBEnv()
d = db.DB(e)
***************
*** 319,323 ****
rlen=None, delim=None, source=None, pad=None):
! flags = _checkflag(flag)
e = _openDBEnv()
d = db.DB(e)
--- 319,323 ----
rlen=None, delim=None, source=None, pad=None):
! flags = _checkflag(flag, file)
e = _openDBEnv()
d = db.DB(e)
***************
*** 340,344 ****
return e
! def _checkflag(flag):
if flag == 'r':
flags = db.DB_RDONLY
--- 340,344 ----
return e
! def _checkflag(flag, file):
if flag == 'r':
flags = db.DB_RDONLY
***************
*** 350,354 ****
flags = db.DB_CREATE
elif flag == 'n':
! flags = db.DB_CREATE | db.DB_TRUNCATE
else:
raise error, "flags should be one of 'r', 'w', 'c' or 'n'"
--- 350,359 ----
flags = db.DB_CREATE
elif flag == 'n':
! flags = db.DB_CREATE
! #flags = db.DB_CREATE | db.DB_TRUNCATE
! # we used db.DB_TRUNCATE flag for this before but BerkeleyDB
! # 4.2.52 changed to disallowed truncate with txn environments.
! if os.path.isfile(file):
! os.unlink(file)
else:
raise error, "flags should be one of 'r', 'w', 'c' or 'n'"
More information about the Python-checkins
mailing list