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
...
@@ -108,16 +108,22 @@ READCHUNK = 16 * 1024
VERBOSE
=
False
VERBOSE
=
False
class
WouldOverwriteFiles
(
Exception
):
class
RepozoError
(
Exception
):
pass
pass
class
NoFiles
(
Exception
):
class
WouldOverwriteFiles
(
RepozoError
):
pass
pass
class
VerificationFail
(
Exception
):
class
NoFiles
(
RepozoError
):
pass
class
VerificationFail
(
RepozoError
):
pass
pass
class
_GzipCloser
(
object
):
class
_GzipCloser
(
object
):
def
__init__
(
self
,
fqn
,
mode
):
def
__init__
(
self
,
fqn
,
mode
):
...
@@ -785,24 +791,16 @@ def main(argv=None):
...
@@ -785,24 +791,16 @@ def main(argv=None):
if
argv
is
None
:
if
argv
is
None
:
argv
=
sys
.
argv
[
1
:]
argv
=
sys
.
argv
[
1
:]
options
=
parseargs
(
argv
)
options
=
parseargs
(
argv
)
if
options
.
mode
==
BACKUP
:
try
:
try
:
if
options
.
mode
==
BACKUP
:
do_backup
(
options
)
do_backup
(
options
)
except
WouldOverwriteFiles
as
e
:
elif
options
.
mode
==
RECOVER
:
sys
.
exit
(
str
(
e
))
except
VerificationFail
as
e
:
sys
.
exit
(
str
(
e
))
elif
options
.
mode
==
RECOVER
:
try
:
do_recover
(
options
)
do_recover
(
options
)
except
NoFiles
as
e
:
else
:
sys
.
exit
(
str
(
e
))
assert
options
.
mode
==
VERIFY
else
:
assert
options
.
mode
==
VERIFY
try
:
do_verify
(
options
)
do_verify
(
options
)
except
NoFiles
as
e
:
except
(
RepozoError
,
OSError
)
as
e
:
sys
.
exit
(
str
(
e
))
sys
.
exit
(
str
(
e
))
if
__name__
==
'__main__'
:
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