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
nexedi
ZODB
Commits
8eb1d702
Commit
8eb1d702
authored
Aug 24, 2009
by
Patrick Strawderman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Blob bug which prevented opening of blobs with no committed data using either mode 'r+' or 'a'.
parent
75d9b564
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
4 deletions
+21
-4
src/CHANGES.txt
src/CHANGES.txt
+3
-0
src/ZODB/blob.py
src/ZODB/blob.py
+5
-4
src/ZODB/tests/blob_basic.txt
src/ZODB/tests/blob_basic.txt
+13
-0
No files found.
src/CHANGES.txt
View file @
8eb1d702
...
...
@@ -22,6 +22,9 @@ Bugs Fixed
- Objects defining _p_deactivate methods that didn't call base methods
weren't loaded properly. https://bugs.launchpad.net/zodb/+bug/185066
- Opening a blob with modes 'r+' or 'a' would fail when the blob had no
committed changes.
3.9.0b5 (2009-08-06)
====================
...
...
src/ZODB/blob.py
View file @
8eb1d702
...
...
@@ -169,14 +169,15 @@ class Blob(persistent.Persistent):
if
self
.
_p_blob_uncommitted
is
None
:
self
.
_create_uncommitted_file
()
result
=
BlobFile
(
self
.
_p_blob_uncommitted
,
mode
,
self
)
else
:
else
:
# 'r+' and 'a'
if
self
.
_p_blob_uncommitted
is
None
:
# Create a new working copy
self
.
_create_uncommitted_file
()
result
=
BlobFile
(
self
.
_p_blob_uncommitted
,
mode
,
self
)
utils
.
cp
(
file
(
self
.
_p_blob_committed
),
result
)
if
mode
==
'r+'
:
result
.
seek
(
0
)
if
self
.
_p_blob_committed
:
utils
.
cp
(
open
(
self
.
_p_blob_committed
),
result
)
if
mode
==
'r+'
:
result
.
seek
(
0
)
else
:
# Re-use existing working copy
result
=
BlobFile
(
self
.
_p_blob_uncommitted
,
mode
,
self
)
...
...
src/ZODB/tests/blob_basic.txt
View file @
8eb1d702
...
...
@@ -156,6 +156,19 @@ Blobs are always opened in binary mode::
'rb'
>>> f9.close()
Blobs that have not been committed can be opened using any mode,
except for "c"::
>>> from ZODB.blob import BlobError, valid_modes
>>> for mode in valid_modes:
... try:
... f10 = Blob().open(mode)
... except BlobError:
... print 'open failed with mode "%s"' % mode
... else:
... f10.close()
open failed with mode "c"
Some cleanup in this test is needed::
>>> import transaction
...
...
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