Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zodb
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua
zodb
Commits
ecbf99ed
Commit
ecbf99ed
authored
Jul 15, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored to release references to the storage on close.
parent
53da5682
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
20 deletions
+32
-20
src/ZODB/DB.py
src/ZODB/DB.py
+32
-20
No files found.
src/ZODB/DB.py
View file @
ecbf99ed
...
...
@@ -483,30 +483,10 @@ class DB(object):
databases
[
database_name
]
=
self
self
.
xrefs
=
xrefs
self
.
_setupUndoMethods
()
self
.
history
=
storage
.
history
self
.
_saved_oids
=
[]
self
.
_max_saved_oids
=
max_saved_oids
self
.
large_record_size
=
large_record_size
def
_setupUndoMethods
(
self
):
storage
=
self
.
storage
try
:
self
.
supportsUndo
=
storage
.
supportsUndo
except
AttributeError
:
self
.
supportsUndo
=
lambda
:
False
if
self
.
supportsUndo
():
self
.
undoLog
=
storage
.
undoLog
if
hasattr
(
storage
,
'undoInfo'
):
self
.
undoInfo
=
storage
.
undoInfo
else
:
self
.
undoLog
=
self
.
undoInfo
=
lambda
*
a
,
**
k
:
()
def
undo
(
*
a
,
**
k
):
raise
NotImplementedError
self
.
undo
=
undo
@
property
def
_storage
(
self
):
# Backward compatibility
return
self
.
storage
...
...
@@ -654,7 +634,17 @@ class DB(object):
is closed, so they stop behaving usefully. Perhaps close()
should also close all the Connections.
"""
noop
=
lambda
*
a
:
None
self
.
close
=
noop
@
self
.
_connectionMap
def
_
(
c
):
c
.
transaction_manager
.
abort
()
c
.
afterCompletion
=
c
.
newTransaction
=
c
.
close
=
noop
c
.
_storage
=
c
.
_normal_storage
=
None
self
.
storage
.
close
()
del
self
.
storage
def
getCacheSize
(
self
):
return
self
.
_cache_size
...
...
@@ -908,6 +898,26 @@ class DB(object):
finally
:
self
.
_r
()
def
history
(
self
,
*
args
,
**
kw
):
return
self
.
storage
.
history
(
*
args
,
**
kw
)
def
supportsUndo
(
self
):
try
:
f
=
self
.
storage
.
supportsUndo
except
AttributeError
:
return
False
return
f
()
def
undoLog
(
self
,
*
args
,
**
kw
):
if
not
self
.
supportsUndo
():
return
()
return
self
.
storage
.
undoLog
(
*
args
,
**
kw
)
def
undoInfo
(
self
,
*
args
,
**
kw
):
if
not
self
.
supportsUndo
():
return
()
return
self
.
storage
.
undoInfo
(
*
args
,
**
kw
)
def
undoMultiple
(
self
,
ids
,
txn
=
None
):
"""Undo multiple transactions identified by ids.
...
...
@@ -925,6 +935,8 @@ class DB(object):
- `txn`: transaction context to use for undo().
By default, uses the current transaction.
"""
if
not
self
.
supportsUndo
():
raise
NotImplementedError
if
txn
is
None
:
txn
=
transaction
.
get
()
if
isinstance
(
ids
,
basestring
):
...
...
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