Commit bbd20aef authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Catch EOF in astakos/quota commands

Abort operation when raw_input raises an EOFError.
parent 8c4cbb98
......@@ -185,7 +185,11 @@ class Command(BaseCommand):
self.stdout.write("Current limit: %s\n" % value)
while True:
self.stdout.write("New limit (leave blank to keep current): ")
response = raw_input()
try:
response = raw_input()
except EOFError:
self.stderr.write("Aborted.\n")
exit()
if response == "":
break
else:
......
......@@ -345,13 +345,11 @@ class Command(BaseCommand):
raise CommandError(m)
management.call_command('user-show', str(user.pk),
list_quotas=True)
m = "Are you sure you want to permanently delete the user " \
"(yes/no) ? "
self.stdout.write("\n")
confirm = raw_input(m)
if confirm == "yes":
user.delete()
if not force:
self.stdout.write("About to delete user %s. " % user.uuid)
self.confirm()
user.delete()
# Change users email address
newemail = options.get('set-email', None)
......@@ -372,7 +370,10 @@ class Command(BaseCommand):
def confirm(self):
self.stdout.write("Confirm? [y/N] ")
response = raw_input()
try:
response = raw_input()
except EOFError:
response = "ABORT"
if string.lower(response) not in ['y', 'yes']:
self.stderr.write("Aborted.\n")
exit()
......
......@@ -78,7 +78,10 @@ class Command(SynnefoCommand):
def confirm(self):
self.stdout.write("Confirm? [y/N] ")
response = raw_input()
try:
response = raw_input()
except EOFError:
response = "ABORT"
if string.lower(response) not in ['y', 'yes']:
self.stderr.write("Aborted.\n")
exit()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment