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
Joshua
zodb
Commits
68d8bca1
Commit
68d8bca1
authored
Mar 01, 2013
by
Marius Gedminas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use with open(): ... for peace of mind
parent
033512a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
src/ZODB/FileStorage/FileStorage.py
src/ZODB/FileStorage/FileStorage.py
+22
-24
No files found.
src/ZODB/FileStorage/FileStorage.py
View file @
68d8bca1
...
...
@@ -1183,34 +1183,32 @@ class FileStorage(
handle_dir
=
ZODB
.
blob
.
remove_committed_dir
# Fist step: move or remove oids or revisions
fp
=
open
(
os
.
path
.
join
(
self
.
blob_dir
,
'.removed'
),
'rb'
)
for
line
in
fp
:
line
=
binascii
.
unhexlify
(
line
.
strip
())
with
open
(
os
.
path
.
join
(
self
.
blob_dir
,
'.removed'
),
'rb'
)
as
fp
:
for
line
in
fp
:
line
=
binascii
.
unhexlify
(
line
.
strip
())
if
len
(
line
)
==
8
:
# oid is garbage, re/move dir
path
=
fshelper
.
getPathForOID
(
line
)
if
not
os
.
path
.
exists
(
path
):
# Hm, already gone. Odd.
continue
handle_dir
(
path
)
maybe_remove_empty_dir_containing
(
path
,
1
)
continue
if
len
(
line
)
!=
16
:
raise
ValueError
(
"Bad record in "
,
self
.
blob_dir
,
'.removed'
)
if
len
(
line
)
==
8
:
# oid is garbage, re/move dir
path
=
fshelper
.
getPathForOID
(
line
)
oid
,
tid
=
line
[:
8
],
line
[
8
:]
path
=
fshelper
.
getBlobFilename
(
oid
,
tid
)
if
not
os
.
path
.
exists
(
path
):
# Hm, already gone. Odd.
continue
handle_dir
(
path
)
maybe_remove_empty_dir_containing
(
path
,
1
)
continue
if
len
(
line
)
!=
16
:
fp
.
close
()
raise
ValueError
(
"Bad record in "
,
self
.
blob_dir
,
'.removed'
)
oid
,
tid
=
line
[:
8
],
line
[
8
:]
path
=
fshelper
.
getBlobFilename
(
oid
,
tid
)
if
not
os
.
path
.
exists
(
path
):
# Hm, already gone. Odd.
continue
handle_file
(
path
)
assert
not
os
.
path
.
exists
(
path
)
maybe_remove_empty_dir_containing
(
path
)
fp
.
close
()
handle_file
(
path
)
assert
not
os
.
path
.
exists
(
path
)
maybe_remove_empty_dir_containing
(
path
)
os
.
remove
(
os
.
path
.
join
(
self
.
blob_dir
,
'.removed'
))
if
not
self
.
pack_keep_old
:
...
...
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