X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/a6f780f0af1886447399563c9abc053e517d4ca0..d555d988764995ea1f9f5ece46f453a66f09b334:/catalogue/management/commands/republish.py?ds=inline diff --git a/catalogue/management/commands/republish.py b/catalogue/management/commands/republish.py deleted file mode 100644 index 941458f..0000000 --- a/catalogue/management/commands/republish.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of EduMed, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from optparse import make_option - -import librarian -from django.core.management.base import BaseCommand - - -class Command(BaseCommand): - help = 'Republishes all lessons.' - - option_list = BaseCommand.option_list + ( - make_option('--exclude', dest='exclude', metavar="PATH", default=None, - help='PATH to file with excluded lesson slugs.'), - make_option('--ignore-incomplete', action='store_true', dest='ignore_incomplete', default=False, - help='Attachments dir path.'), - make_option('--dont-repackage', action='store_false', dest='repackage', default=True, - help='Don\'t refresh level packages.'), - ) - - def handle(self, **options): - from catalogue.models import Lesson - from curriculum.models import Level - - lessons = Lesson.objects.order_by('slug') - - if options.get('exclude'): - slugs = [line.strip() for line in open(options['exclude'])] - lessons = lessons.exclude(slug__in=slugs) - - for lesson in lessons: - print - print 'Republishing: %s' % lesson.slug - try: - lesson.republish(repackage_level=False) - except librarian.ParseError as e: - print '!!!!!! PARSE ERROR !!!!!!' - print e - - print 'Rebuilding levels...' - for level in Level.objects.all(): - level.build_packages()