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
Kirill Smelkov
ZODB
Commits
91c7c629
Commit
91c7c629
authored
Nov 05, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better fix for George Bailey events.
Also, add sanity checks in _getVersion() and _getSerial().
parent
0dc7ce85
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
src/ZODB/FileStorage.py
src/ZODB/FileStorage.py
+21
-14
No files found.
src/ZODB/FileStorage.py
View file @
91c7c629
...
...
@@ -115,7 +115,7 @@
# may have a back pointer to a version record or to a non-version
# record.
#
__version__
=
'$Revision: 1.11
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.11
2
$'
[
11
:
-
2
]
import
base64
from
cPickle
import
Pickler
,
Unpickler
,
loads
...
...
@@ -1045,19 +1045,20 @@ class FileStorage(BaseStorage.BaseStorage,
def
_getVersion
(
self
,
oid
,
pos
):
self
.
_file
.
seek
(
pos
)
read
=
self
.
_file
.
read
h
=
read
(
DATA_HDR_LEN
)
doid
,
serial
,
sprev
,
stloc
,
vlen
,
splen
=
unpack
(
DATA_HDR
,
h
)
h
=
self
.
_file
.
read
(
DATA_HDR_LEN
)
doid
,
serial
,
sprev
,
stloc
,
vlen
,
splen
=
unpack
(
DATA_HDR
,
h
)
assert
doid
==
oid
if
vlen
:
h
=
read
(
16
)
return
read
(
vlen
),
h
[:
8
]
h
=
self
.
_file
.
read
(
16
)
return
self
.
_file
.
read
(
vlen
),
h
[:
8
]
else
:
return
''
,
''
return
''
,
''
def
_getSerial
(
self
,
oid
,
pos
):
self
.
_file
.
seek
(
pos
+
8
)
return
self
.
_file
.
read
(
8
)
self
.
_file
.
seek
(
pos
)
h
=
self
.
_file
.
read
(
16
)
assert
oid
==
h
[:
8
]
return
h
[
8
:]
def
_transactionalUndoRecord
(
self
,
oid
,
pos
,
serial
,
pre
,
version
):
"""Get the indo information for a data record
...
...
@@ -1069,6 +1070,8 @@ class FileStorage(BaseStorage.BaseStorage,
"""
copy
=
1
# Can we just copy a data pointer
# First check if it is possible to undo this record.
tpos
=
self
.
_tindex
.
get
(
oid
,
0
)
ipos
=
self
.
_index
.
get
(
oid
,
0
)
tipos
=
tpos
or
ipos
...
...
@@ -1103,10 +1106,13 @@ class FileStorage(BaseStorage.BaseStorage,
# LoadBack gave us a key error. Bail.
raise
UndoError
if
pre
:
# Return the data that should be written in the undo record.
if
not
pre
:
# There is no previous revision, because the object creation
# is being undone.
return
''
,
0
,
''
,
''
,
ipos
version
,
snv
=
self
.
_getVersion
(
oid
,
pre
)
else
:
version
,
snv
=
''
,
''
if
copy
:
# we can just copy our previous-record pointer forward
return
''
,
pre
,
version
,
snv
,
ipos
...
...
@@ -1265,7 +1271,7 @@ class FileStorage(BaseStorage.BaseStorage,
tindex
[
oid
]
=
here
here
+=
odlen
pos
=
pos
+
dlen
pos
+=
dlen
if
pos
>
tend
:
raise
UndoError
,
'non-undoable transaction'
...
...
@@ -2142,6 +2148,7 @@ def _loadBack_impl(file, oid, back):
while
1
:
old
=
U64
(
back
)
if
not
old
:
# If the backpointer is 0, the object does not currently exist.
raise
POSKeyError
(
oid
)
file
.
seek
(
old
)
h
=
file
.
read
(
DATA_HDR_LEN
)
...
...
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