summaryrefslogtreecommitdiffstats
path: root/Lib/bsddb/__init__.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2003-01-28 17:20:44 (GMT)
committerBarry Warsaw <barry@python.org>2003-01-28 17:20:44 (GMT)
commitf71de3e9a017d698be8ee4db3e2ec5fbc68bfc8c (patch)
treeb31170225a2c763246014d72e4d5db8b31fc5354 /Lib/bsddb/__init__.py
parenta6ae9a2128a85301ded9381c181539720ce82ca0 (diff)
downloadcpython-f71de3e9a017d698be8ee4db3e2ec5fbc68bfc8c.zip
cpython-f71de3e9a017d698be8ee4db3e2ec5fbc68bfc8c.tar.gz
cpython-f71de3e9a017d698be8ee4db3e2ec5fbc68bfc8c.tar.bz2
Everything worked in both the distutils distro and in Python 2.3cvs,
so merge from the bsddb-bsddb3-schizo-branch back to the trunk.
Diffstat (limited to 'Lib/bsddb/__init__.py')
-rw-r--r--Lib/bsddb/__init__.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py
index a43aff7..e62d249 100644
--- a/Lib/bsddb/__init__.py
+++ b/Lib/bsddb/__init__.py
@@ -44,11 +44,11 @@ except ImportError:
del sys.modules[__name__]
raise
-# bsddb3 calls it _db
-_db = _bsddb
-__version__ = _db.__version__
+# 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...
+error = db.DBError # So bsddb.error will mean something...
#----------------------------------------------------------------------
@@ -152,14 +152,14 @@ def hashopen(file, flag='c', mode=0666, pgsize=None, ffactor=None, nelem=None,
cachesize=None, lorder=None, hflags=0):
flags = _checkflag(flag)
- d = _db.DB()
+ d = db.DB()
d.set_flags(hflags)
if cachesize is not None: d.set_cachesize(0, cachesize)
if pgsize is not None: d.set_pagesize(pgsize)
if lorder is not None: d.set_lorder(lorder)
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)
+ d.open(file, db.DB_HASH, flags, mode)
return _DBWithCursor(d)
#----------------------------------------------------------------------
@@ -169,14 +169,14 @@ def btopen(file, flag='c', mode=0666,
pgsize=None, lorder=None):
flags = _checkflag(flag)
- d = _db.DB()
+ d = db.DB()
if cachesize is not None: d.set_cachesize(0, cachesize)
if pgsize is not None: d.set_pagesize(pgsize)
if lorder is not None: d.set_lorder(lorder)
d.set_flags(btflags)
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)
+ d.open(file, db.DB_BTREE, flags, mode)
return _DBWithCursor(d)
#----------------------------------------------------------------------
@@ -187,7 +187,7 @@ def rnopen(file, flag='c', mode=0666,
rlen=None, delim=None, source=None, pad=None):
flags = _checkflag(flag)
- d = _db.DB()
+ d = db.DB()
if cachesize is not None: d.set_cachesize(0, cachesize)
if pgsize is not None: d.set_pagesize(pgsize)
if lorder is not None: d.set_lorder(lorder)
@@ -196,7 +196,7 @@ def rnopen(file, flag='c', mode=0666,
if rlen is not None: d.set_re_len(rlen)
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)
+ d.open(file, db.DB_RECNO, flags, mode)
return _DBWithCursor(d)
#----------------------------------------------------------------------
@@ -204,18 +204,18 @@ def rnopen(file, flag='c', mode=0666,
def _checkflag(flag):
if flag == 'r':
- flags = _db.DB_RDONLY
+ flags = db.DB_RDONLY
elif flag == 'rw':
flags = 0
elif flag == 'w':
- flags = _db.DB_CREATE
+ flags = db.DB_CREATE
elif flag == 'c':
- flags = _db.DB_CREATE
+ flags = db.DB_CREATE
elif flag == 'n':
- flags = _db.DB_CREATE | _db.DB_TRUNCATE
+ 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
+ return flags | db.DB_THREAD
#----------------------------------------------------------------------
@@ -231,7 +231,7 @@ try:
import thread
del thread
except ImportError:
- _db.DB_THREAD = 0
+ db.DB_THREAD = 0
#----------------------------------------------------------------------