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
Show 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,7 +1183,7 @@ class FileStorage(
...
@@ -1183,7 +1183,7 @@ class FileStorage(
handle_dir
=
ZODB
.
blob
.
remove_committed_dir
handle_dir
=
ZODB
.
blob
.
remove_committed_dir
# Fist step: move or remove oids or revisions
# Fist step: move or remove oids or revisions
fp
=
open
(
os
.
path
.
join
(
self
.
blob_dir
,
'.removed'
),
'rb'
)
with
open
(
os
.
path
.
join
(
self
.
blob_dir
,
'.removed'
),
'rb'
)
as
fp
:
for
line
in
fp
:
for
line
in
fp
:
line
=
binascii
.
unhexlify
(
line
.
strip
())
line
=
binascii
.
unhexlify
(
line
.
strip
())
...
@@ -1198,7 +1198,6 @@ class FileStorage(
...
@@ -1198,7 +1198,6 @@ class FileStorage(
continue
continue
if
len
(
line
)
!=
16
:
if
len
(
line
)
!=
16
:
fp
.
close
()
raise
ValueError
(
"Bad record in "
,
self
.
blob_dir
,
'.removed'
)
raise
ValueError
(
"Bad record in "
,
self
.
blob_dir
,
'.removed'
)
oid
,
tid
=
line
[:
8
],
line
[
8
:]
oid
,
tid
=
line
[:
8
],
line
[
8
:]
...
@@ -1210,7 +1209,6 @@ class FileStorage(
...
@@ -1210,7 +1209,6 @@ class FileStorage(
assert
not
os
.
path
.
exists
(
path
)
assert
not
os
.
path
.
exists
(
path
)
maybe_remove_empty_dir_containing
(
path
)
maybe_remove_empty_dir_containing
(
path
)
fp
.
close
()
os
.
remove
(
os
.
path
.
join
(
self
.
blob_dir
,
'.removed'
))
os
.
remove
(
os
.
path
.
join
(
self
.
blob_dir
,
'.removed'
))
if
not
self
.
pack_keep_old
:
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