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
7ec117d6
Commit
7ec117d6
authored
Feb 27, 2006
by
Christian Theune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- removed best_rename, using os.rename again
parent
8c3aa9ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
25 deletions
+2
-25
src/ZODB/Blobs/BlobStorage.py
src/ZODB/Blobs/BlobStorage.py
+1
-1
src/ZODB/Connection.py
src/ZODB/Connection.py
+1
-1
src/ZODB/utils.py
src/ZODB/utils.py
+0
-23
No files found.
src/ZODB/Blobs/BlobStorage.py
View file @
7ec117d6
...
...
@@ -63,7 +63,7 @@ class BlobStorage(ProxyBase):
os
.
makedirs
(
targetpath
,
0700
)
targetname
=
self
.
_getCleanFilename
(
oid
,
serial
)
utils
.
best_
rename
(
blobfilename
,
targetname
)
os
.
rename
(
blobfilename
,
targetname
)
# XXX if oid already in there, something is really hosed.
# The underlying storage should have complained anyway
...
...
src/ZODB/Connection.py
View file @
7ec117d6
...
...
@@ -1205,7 +1205,7 @@ class TmpStore:
os
.
makedirs
(
targetpath
,
0700
)
targetname
=
self
.
_getCleanFilename
(
oid
,
serial
)
utils
.
best_
rename
(
blobfilename
,
targetname
)
os
.
rename
(
blobfilename
,
targetname
)
def
loadBlob
(
self
,
oid
,
serial
,
version
):
"""Return the filename where the blob file can be found.
...
...
src/ZODB/utils.py
View file @
7ec117d6
...
...
@@ -295,27 +295,4 @@ def mktemp():
os
.
close
(
handle
)
return
filename
def
best_rename
(
sourcename
,
targetname
):
""" Try to rename via os.rename, but if we can't (for instance, if the
source and target are on separate partitions/volumes), fall back to copying
the file and unlinking the original. """
try
:
os
.
rename
(
sourcename
,
targetname
)
except
OSError
:
# XXX CM: I don't think this is a good idea; maybe just fail
# here instead of doing a brute force copy? This is awfully
# expensive and people won't know it's happening without
# at least a warning. It also increases the possibility of a race
# condition: both the source and target filenames exist at the
# same time.
source
=
open
(
sourcename
,
"rb"
)
target
=
open
(
targetname
,
"wb"
)
while
True
:
chunk
=
source
.
read
(
1
<<
16
)
if
not
chunk
:
break
target
.
write
(
chunk
)
source
.
close
()
target
.
close
()
os
.
unlink
(
sourcename
)
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