def handle(self, *args, **options):
try:
username = args[0]
except IndexError:
raise CommandError(_("You must provide the username to publish the"
" form to."))
# make sure user exists
try:
User.objects.get(username=username)
except User.DoesNotExist:
raise CommandError(_("The user '%s' does not exist.") % username)
try:
input_file = args[1]
except IndexError:
raise CommandError(_("You must provide the path to restore from."))
else:
input_file = os.path.realpath(input_file)
num_instances, num_restored = restore_backup_from_zip(
input_file, username)
sys.stdout.write("Restored %d of %d submissions\n" %
(num_restored, num_instances))
评论列表
文章目录