Replace exit() by sys.exit()

sys.exit() is considered good to use in programs.

Change-Id: I2cd75a15e7ec82c502c22f0be6440b6db4c9a94a
This commit is contained in:
Qiaowei Ren 2016-02-01 14:49:05 +08:00
parent 16c883b6c9
commit fc53a11ce3
1 changed files with 3 additions and 6 deletions

View File

@ -156,14 +156,11 @@ class DbCommands(object):
age_in_days = int(age_in_days)
max_rows = int(max_rows)
if age_in_days <= 0:
print(_("Must supply a positive, non-zero value for age."))
exit(1)
sys.exit(_("Must supply a positive, non-zero value for age."))
if age_in_days >= (int(time.time()) / 86400):
print(_("Maximal age is count of days since epoch."))
exit(1)
sys.exit(_("Maximal age is count of days since epoch."))
if max_rows < 1:
print(_("Minimal rows limit is 1."))
exit(1)
sys.exit(_("Minimal rows limit is 1."))
ctx = context.get_admin_context(show_deleted=True)
db_api.purge_deleted_rows(ctx, age_in_days, max_rows)