Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
8d589632
Commit
8d589632
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
f1fda277
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 @
8d589632
...
@@ -483,30 +483,10 @@ class DB(object):
...
@@ -483,30 +483,10 @@ class DB(object):
databases
[
database_name
]
=
self
databases
[
database_name
]
=
self
self
.
xrefs
=
xrefs
self
.
xrefs
=
xrefs
self
.
_setupUndoMethods
()
self
.
history
=
storage
.
history
self
.
_saved_oids
=
[]
self
.
_saved_oids
=
[]
self
.
_max_saved_oids
=
max_saved_oids
self
.
_max_saved_oids
=
max_saved_oids
self
.
large_record_size
=
large_record_size
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
@
property
def
_storage
(
self
):
# Backward compatibility
def
_storage
(
self
):
# Backward compatibility
return
self
.
storage
return
self
.
storage
...
@@ -654,7 +634,17 @@ class DB(object):
...
@@ -654,7 +634,17 @@ class DB(object):
is closed, so they stop behaving usefully. Perhaps close()
is closed, so they stop behaving usefully. Perhaps close()
should also close all the Connections.
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
()
self
.
storage
.
close
()
del
self
.
storage
def
getCacheSize
(
self
):
def
getCacheSize
(
self
):
return
self
.
_cache_size
return
self
.
_cache_size
...
@@ -908,6 +898,26 @@ class DB(object):
...
@@ -908,6 +898,26 @@ class DB(object):
finally
:
finally
:
self
.
_r
()
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
):
def
undoMultiple
(
self
,
ids
,
txn
=
None
):
"""Undo multiple transactions identified by ids.
"""Undo multiple transactions identified by ids.
...
@@ -925,6 +935,8 @@ class DB(object):
...
@@ -925,6 +935,8 @@ class DB(object):
- `txn`: transaction context to use for undo().
- `txn`: transaction context to use for undo().
By default, uses the current transaction.
By default, uses the current transaction.
"""
"""
if
not
self
.
supportsUndo
():
raise
NotImplementedError
if
txn
is
None
:
if
txn
is
None
:
txn
=
transaction
.
get
()
txn
=
transaction
.
get
()
if
isinstance
(
ids
,
basestring
):
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