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
1c6a9828
Commit
1c6a9828
authored
Dec 18, 2018
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repozo: simplify the handling of Errors in the main function
parent
b94910cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
18 deletions
+16
-18
src/ZODB/scripts/repozo.py
src/ZODB/scripts/repozo.py
+16
-18
No files found.
src/ZODB/scripts/repozo.py
View file @
1c6a9828
...
...
@@ -108,16 +108,22 @@ READCHUNK = 16 * 1024
VERBOSE
=
False
class
WouldOverwriteFiles
(
Exception
):
class
RepozoError
(
Exception
):
pass
class
NoFiles
(
Exception
):
class
WouldOverwriteFiles
(
RepozoError
):
pass
class
VerificationFail
(
Exception
):
class
NoFiles
(
RepozoError
):
pass
class
VerificationFail
(
RepozoError
):
pass
class
_GzipCloser
(
object
):
def
__init__
(
self
,
fqn
,
mode
):
...
...
@@ -785,24 +791,16 @@ def main(argv=None):
if
argv
is
None
:
argv
=
sys
.
argv
[
1
:]
options
=
parseargs
(
argv
)
if
options
.
mode
==
BACKUP
:
try
:
try
:
if
options
.
mode
==
BACKUP
:
do_backup
(
options
)
except
WouldOverwriteFiles
as
e
:
sys
.
exit
(
str
(
e
))
except
VerificationFail
as
e
:
sys
.
exit
(
str
(
e
))
elif
options
.
mode
==
RECOVER
:
try
:
elif
options
.
mode
==
RECOVER
:
do_recover
(
options
)
except
NoFiles
as
e
:
sys
.
exit
(
str
(
e
))
else
:
assert
options
.
mode
==
VERIFY
try
:
else
:
assert
options
.
mode
==
VERIFY
do_verify
(
options
)
except
NoFiles
as
e
:
sys
.
exit
(
str
(
e
))
except
(
RepozoError
,
OSError
)
as
e
:
sys
.
exit
(
str
(
e
))
if
__name__
==
'__main__'
:
...
...
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