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
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
Nicolas Wavrant
ZODB
Commits
07766aca
Commit
07766aca
authored
Apr 22, 2003
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Guard against not having a base in all cases.
parent
7f38c7b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
src/ZODB/DemoStorage.py
src/ZODB/DemoStorage.py
+12
-10
No files found.
src/ZODB/DemoStorage.py
View file @
07766aca
...
...
@@ -79,7 +79,7 @@ method::
and call it to monitor the storage.
"""
__version__
=
'$Revision: 1.1
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
8
$'
[
11
:
-
2
]
import
base64
,
time
,
string
from
ZODB
import
POSException
,
BaseStorage
,
utils
...
...
@@ -90,7 +90,6 @@ from BTrees import OOBTree
class
DemoStorage
(
BaseStorage
.
BaseStorage
):
def
__init__
(
self
,
name
=
'Demo Storage'
,
base
=
None
,
quota
=
None
):
BaseStorage
.
BaseStorage
.
__init__
(
self
,
name
,
base
)
# We use a BTree because the items are sorted!
...
...
@@ -226,13 +225,16 @@ class DemoStorage(BaseStorage.BaseStorage):
self
.
_lock_acquire
()
try
:
old
=
self
.
_index
.
get
(
oid
,
None
)
old
=
self
.
_index
.
get
(
oid
,
None
)
if
old
is
None
:
# Hm, nothing here, check the base version:
try
:
p
,
oserial
=
self
.
_base
.
load
(
oid
,
''
)
except
:
pass
else
:
old
=
oid
,
oserial
,
None
,
None
,
p
if
self
.
_base
:
try
:
p
,
oserial
=
self
.
_base
.
load
(
oid
,
''
)
except
KeyError
:
pass
else
:
old
=
oid
,
oserial
,
None
,
None
,
p
nv
=
None
if
old
:
...
...
@@ -453,9 +455,9 @@ class DemoStorage(BaseStorage.BaseStorage):
# Scan non-version pickle for references
r
=
index
.
get
(
oid
,
None
)
if
r
is
None
:
# Base storage
p
,
s
=
self
.
_base
.
load
(
oid
,
''
)
referencesf
(
p
,
rootl
)
if
self
.
_base
:
p
,
s
=
self
.
_base
.
load
(
oid
,
''
)
referencesf
(
p
,
rootl
)
else
:
pindex
[
oid
]
=
r
oid
,
serial
,
pre
,
vdata
,
p
=
r
...
...
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