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
e5dbf27c
Commit
e5dbf27c
authored
Feb 28, 2006
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added test for special undo situation
- added small non-yet-working work-around
parent
6a667c11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
src/ZODB/Blobs/BlobStorage.py
src/ZODB/Blobs/BlobStorage.py
+8
-2
src/ZODB/Blobs/tests/test_undo.py
src/ZODB/Blobs/tests/test_undo.py
+20
-0
No files found.
src/ZODB/Blobs/BlobStorage.py
View file @
e5dbf27c
...
...
@@ -193,14 +193,20 @@ class BlobStorage(ProxyBase):
return
orig_size
+
blob_size
def
undo
(
self
,
serial_id
,
transaction
):
import
pdb
;
pdb
.
set_trace
()
serial
,
keys
=
getProxiedObject
(
self
).
undo
(
serial_id
,
transaction
)
self
.
_lock_acquire
()
try
:
# The old serial_id is given in base64 encoding ...
serial_id
=
base64
.
decodestring
(
serial_id
+
'
\
n
'
)
for
oid
in
self
.
fshelper
.
getOIDsForSerial
(
serial_id
):
data
,
serial_before
,
serial_after
=
self
.
loadBefore
(
oid
,
serial_id
)
load_result
=
self
.
loadBefore
(
oid
,
serial_id
)
if
load_result
is
None
:
continue
data
,
serial_before
,
serial_after
=
load_result
orig_fn
=
self
.
fshelper
.
getBlobFilename
(
oid
,
serial_before
)
orig
=
open
(
orig_fn
,
"r"
)
new_fn
=
self
.
fshelper
.
getBlobFilename
(
oid
,
serial
)
...
...
src/ZODB/Blobs/tests/test_undo.py
View file @
e5dbf27c
...
...
@@ -37,6 +37,26 @@ class BlobUndoTests(unittest.TestCase):
pass
shutil
.
rmtree
(
self
.
blob_dir
)
def
testUndoWithoutPreviousVersion
(
self
):
base_storage
=
FileStorage
(
self
.
storagefile
)
blob_storage
=
BlobStorage
(
self
.
blob_dir
,
base_storage
)
database
=
DB
(
blob_storage
)
connection
=
database
.
open
()
root
=
connection
.
root
()
transaction
.
begin
()
blob
=
Blob
()
blob
.
open
(
'w'
).
write
(
'this is state 1'
)
root
[
'blob'
]
=
blob
transaction
.
commit
()
serial
=
base64
.
encodestring
(
blob_storage
.
_tid
)
transaction
.
begin
()
blob_storage
.
undo
(
serial
,
blob_storage
.
_transaction
)
transaction
.
commit
()
self
.
assertRaises
(
KeyError
,
root
.
__getitem__
,
'blob'
)
def
testUndo
(
self
):
base_storage
=
FileStorage
(
self
.
storagefile
)
blob_storage
=
BlobStorage
(
self
.
blob_dir
,
base_storage
)
...
...
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