Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bfac8e56
Commit
bfac8e56
authored
Feb 08, 2003
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compatibility for earlier versions of Python (than 2.3), which
doesn't have UserDict.DictMixin.
parent
c9b347ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
Lib/bsddb/dbobj.py
Lib/bsddb/dbobj.py
+6
-1
Lib/bsddb/dbshelve.py
Lib/bsddb/dbshelve.py
+9
-4
No files found.
Lib/bsddb/dbobj.py
View file @
bfac8e56
...
...
@@ -16,7 +16,12 @@
#
import
db
from
UserDict
import
DictMixin
try
:
from
UserDict
import
DictMixin
except
ImportError
:
# DictMixin is new in Python 2.3
class
DictMixin
:
pass
class
DBEnv
:
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
Lib/bsddb/dbshelve.py
View file @
bfac8e56
...
...
@@ -30,7 +30,11 @@ storage.
#------------------------------------------------------------------------
import
cPickle
from
UserDict
import
DictMixin
try
:
from
UserDict
import
DictMixin
except
ImportError
:
# DictMixin is new in Python 2.3
class
DictMixin
:
pass
try
:
# For Python 2.3
from
bsddb
import
db
...
...
@@ -77,8 +81,7 @@ def open(filename, flags=db.DB_CREATE, mode=0660, filetype=db.DB_HASH,
#---------------------------------------------------------------------------
class
DBShelf
(
DictMixin
):
"""
A shelf to hold pickled objects, built upon a bsddb DB object. It
"""A shelf to hold pickled objects, built upon a bsddb DB object. It
automatically pickles/unpickles data objects going to/from the DB.
"""
def
__init__
(
self
,
dbenv
=
None
):
...
...
@@ -91,7 +94,9 @@ class DBShelf(DictMixin):
def
__getattr__
(
self
,
name
):
"""Many methods we can just pass through to the DB object. (See below)"""
"""Many methods we can just pass through to the DB object.
(See below)
"""
return
getattr
(
self
.
db
,
name
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment