increase max length of attachment file path
[edumed.git] / catalogue / management / commands / republish.py
index 3ed17d1..48f9345 100644 (file)
@@ -4,6 +4,7 @@
 #
 from optparse import make_option
 
 #
 from optparse import make_option
 
+import librarian
 from django.core.management.base import BaseCommand
 
 
 from django.core.management.base import BaseCommand
 
 
@@ -32,12 +33,14 @@ class Command(BaseCommand):
         for lesson in lessons:
             print
             print 'Republishing: %s' % lesson.slug
         for lesson in lessons:
             print
             print 'Republishing: %s' % lesson.slug
-            # try:
-            lesson.republish(repackage_level=False)
-            # except BaseException as e:
-            #     print '!!!!!! EXCEPTION !!!!!!'
-            #     print e
-
-        print 'Rebuilding levels...'
-        for level in Level.objects.all():
-            level.build_packages()
+            try:
+                lesson.republish(repackage_level=False)
+            except librarian.ParseError as e:
+                print '!!!!!! PARSE ERROR !!!!!!'
+                print e
+
+        if options.get('repackage'):
+            print 'Rebuilding levels...'
+            for level in Level.objects.all():
+                print level.name
+                level.build_packages()