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
ce252850
Commit
ce252850
authored
Feb 08, 2008
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in TmpStore: load() would not defer to the backend storage.
parent
ac35b4df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
3 deletions
+60
-3
NEWS.txt
NEWS.txt
+4
-1
src/ZODB/Connection.py
src/ZODB/Connection.py
+1
-1
src/ZODB/tests/blob_transaction.txt
src/ZODB/tests/blob_transaction.txt
+1
-1
src/ZODB/tests/testblob.py
src/ZODB/tests/testblob.py
+54
-0
No files found.
NEWS.txt
View file @
ce252850
...
...
@@ -33,7 +33,7 @@ General
ZEO
---
- (???) Fixed bug in transaction buffer: a tuple was unpack
g
ed incorrectly in
- (???) Fixed bug in transaction buffer: a tuple was unpacked incorrectly in
`clear`.
- (???) Fixed bug in blob filesystem helper: the `isSecure` check was inversed.
...
...
@@ -95,6 +95,9 @@ Transactions
Blobs
-----
- (???) Fixed bug in Connection.TmpStore: load() would not defer to the
backend storage for loading blobs.
- (3.8b5) Fixed bug #130459: Packing was broken by uncommitted blob data.
- (3.8b4) Fixed bug #127182: Blobs were subclassable which was not desired.
...
...
src/ZODB/Connection.py
View file @
ce252850
...
...
@@ -1260,7 +1260,7 @@ class TmpStore:
self
.
_storage
)
filename
=
self
.
_getCleanFilename
(
oid
,
serial
)
if
not
os
.
path
.
exists
(
filename
):
r
aise
POSKeyError
(
"No blob file"
,
oid
,
serial
)
r
eturn
self
.
_storage
.
loadBlob
(
oid
,
serial
)
return
filename
def
_getBlobPath
(
self
,
oid
):
...
...
src/ZODB/tests/blob_transaction.txt
View file @
ce252850
...
...
@@ -247,7 +247,7 @@ We do support optimistic savepoints:
"I'm a happy blob. And I'm singing."
>>> transaction.commit()
We support optimistic savepoints too:
We support
non-
optimistic savepoints too:
>>> root5['blob'].open("a").write(" And I'm dancing.")
>>> root5['blob'].open("r").read()
...
...
src/ZODB/tests/testblob.py
View file @
ce252850
...
...
@@ -443,6 +443,60 @@ def secure_blob_directory():
"""
def
loadblob_tmpstore
():
"""
This is a test for assuring that the TmpStore's loadBlob implementation
falls back correctly to loadBlob on the backend.
First, let's setup a regular database and store a blob:
>>> import transaction
>>> from ZODB.FileStorage.FileStorage import FileStorage
>>> from ZODB.blob import BlobStorage
>>> from ZODB.DB import DB
>>> from ZODB.serialize import referencesf
>>> from tempfile import mkdtemp, mktemp
>>> storagefile = mktemp()
>>> base_storage = FileStorage(storagefile)
>>> blob_dir = mkdtemp()
>>> blob_storage = BlobStorage(blob_dir, base_storage)
>>> database = DB(blob_storage)
>>> connection = database.open()
>>> root = connection.root()
>>> from ZODB.blob import Blob
>>> root['blob'] = Blob()
>>> connection.add(root['blob'])
>>> root['blob'].open('w').write('test')
>>> import transaction
>>> transaction.commit()
>>> blob_oid = root['blob']._p_oid
>>> tid = blob_storage.lastTransaction()
Now we open a database with a TmpStore in front:
>>> database.close()
>>> from ZODB.Connection import TmpStore
>>> tmpstore = TmpStore('', blob_storage)
We can access the blob correctly:
>>> tmpstore.loadBlob(blob_oid, tid) # doctest: +ELLIPSIS
'.../0x01/0x...blob'
Clean up:
>>> database.close()
>>> import shutil
>>> shutil.rmtree(blob_dir)
>>> os.unlink(storagefile)
>>> os.unlink(storagefile+".index")
>>> os.unlink(storagefile+".tmp")
"""
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
ZODBBlobConfigTest
))
...
...
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