restore_backup.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:fieldsight-kobocat 作者: awemulya 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号