]> git.parisson.com Git - teleforma.git/commitdiff
fix no file
authorGuillaume Pellerin <yomguy@parisson.com>
Sun, 20 Jul 2014 10:39:33 +0000 (12:39 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Sun, 20 Jul 2014 10:39:33 +0000 (12:39 +0200)
teleforma/management/commands/teleforma-exam-submit-scripts.py

index 5d0970da30574034e88380e249746f3201367a4b..2c74e2fb1b454a0b79854bd2e72264e10ab00ad9 100644 (file)
@@ -9,7 +9,7 @@ from telemeta.util.unaccent import unaccent
 from teleforma.exam.models import *
 import logging
 import codecs
-import time
+import time, os
 
 
 class Logger:
@@ -33,12 +33,14 @@ class Command(BaseCommand):
         for script in Script.objects.filter(status=2):
             logger.logger.info(script.title)
             if script.file:
-                script.fix_filename()
-                try:
-                    script.submit()
-                except:
-                    logger.logger.error('ERROR')
-                logger.logger.info('OK')
-                time.sleep(30)
+               if os.path.exists(script.file):
+                       script.fix_filename()
+                       try:
+                           script.submit()
+                       except:
+                           logger.logger.error('ERROR')
+                       logger.logger.info('OK')
+                       time.sleep(30)
             else:
-                print unicode(script)
+               logger.logger.error('No file!')
+