[Python-checkins] python/dist/src/Lib/bsddb __init__.py,1.3,1.3.4.1
bwarsaw@users.sourceforge.net
bwarsaw@users.sourceforge.net
Tue, 28 Jan 2003 07:33:07 -0800
Update of /cvsroot/python/python/dist/src/Lib/bsddb
In directory sc8-pr-cvs1:/tmp/cvs-serv23888
Modified Files:
Tag: bsddb-bsddb3-schizo-branch
__init__.py
Log Message:
Promote the use of bsddb3.db instead of bsddb3._db for the public API,
and use db everywhere in this package. Continue to provide _db for
backwards compatibility.
Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/__init__.py,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -C2 -d -r1.3 -r1.3.4.1
*** __init__.py 30 Dec 2002 20:52:07 -0000 1.3
--- __init__.py 28 Jan 2003 15:33:04 -0000 1.3.4.1
***************
*** 45,53 ****
raise
! # bsddb3 calls it _db
! _db = _bsddb
! __version__ = _db.__version__
! error = _db.DBError # So bsddb.error will mean something...
#----------------------------------------------------------------------
--- 45,53 ----
raise
! # bsddb3 calls it db, but provide _db for backwards compatibility
! db = _db = _bsddb
! __version__ = db.__version__
! error = db.DBError # So bsddb.error will mean something...
#----------------------------------------------------------------------
***************
*** 153,157 ****
flags = _checkflag(flag)
! d = _db.DB()
d.set_flags(hflags)
if cachesize is not None: d.set_cachesize(0, cachesize)
--- 153,157 ----
flags = _checkflag(flag)
! d = db.DB()
d.set_flags(hflags)
if cachesize is not None: d.set_cachesize(0, cachesize)
***************
*** 160,164 ****
if ffactor is not None: d.set_h_ffactor(ffactor)
if nelem is not None: d.set_h_nelem(nelem)
! d.open(file, _db.DB_HASH, flags, mode)
return _DBWithCursor(d)
--- 160,164 ----
if ffactor is not None: d.set_h_ffactor(ffactor)
if nelem is not None: d.set_h_nelem(nelem)
! d.open(file, db.DB_HASH, flags, mode)
return _DBWithCursor(d)
***************
*** 170,174 ****
flags = _checkflag(flag)
! d = _db.DB()
if cachesize is not None: d.set_cachesize(0, cachesize)
if pgsize is not None: d.set_pagesize(pgsize)
--- 170,174 ----
flags = _checkflag(flag)
! d = db.DB()
if cachesize is not None: d.set_cachesize(0, cachesize)
if pgsize is not None: d.set_pagesize(pgsize)
***************
*** 177,181 ****
if minkeypage is not None: d.set_bt_minkey(minkeypage)
if maxkeypage is not None: d.set_bt_maxkey(maxkeypage)
! d.open(file, _db.DB_BTREE, flags, mode)
return _DBWithCursor(d)
--- 177,181 ----
if minkeypage is not None: d.set_bt_minkey(minkeypage)
if maxkeypage is not None: d.set_bt_maxkey(maxkeypage)
! d.open(file, db.DB_BTREE, flags, mode)
return _DBWithCursor(d)
***************
*** 188,192 ****
flags = _checkflag(flag)
! d = _db.DB()
if cachesize is not None: d.set_cachesize(0, cachesize)
if pgsize is not None: d.set_pagesize(pgsize)
--- 188,192 ----
flags = _checkflag(flag)
! d = db.DB()
if cachesize is not None: d.set_cachesize(0, cachesize)
if pgsize is not None: d.set_pagesize(pgsize)
***************
*** 197,201 ****
if source is not None: d.set_re_source(source)
if pad is not None: d.set_re_pad(pad)
! d.open(file, _db.DB_RECNO, flags, mode)
return _DBWithCursor(d)
--- 197,201 ----
if source is not None: d.set_re_source(source)
if pad is not None: d.set_re_pad(pad)
! d.open(file, db.DB_RECNO, flags, mode)
return _DBWithCursor(d)
***************
*** 205,220 ****
def _checkflag(flag):
if flag == 'r':
! flags = _db.DB_RDONLY
elif flag == 'rw':
flags = 0
elif flag == 'w':
! flags = _db.DB_CREATE
elif flag == 'c':
! 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'"
! return flags | _db.DB_THREAD
#----------------------------------------------------------------------
--- 205,220 ----
def _checkflag(flag):
if flag == 'r':
! flags = db.DB_RDONLY
elif flag == 'rw':
flags = 0
elif flag == 'w':
! flags = db.DB_CREATE
elif flag == 'c':
! 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'"
! return flags | db.DB_THREAD
#----------------------------------------------------------------------
***************
*** 232,236 ****
del thread
except ImportError:
! _db.DB_THREAD = 0
--- 232,236 ----
del thread
except ImportError:
! db.DB_THREAD = 0