]> git.parisson.com Git - teleforma.git/commitdiff
Re-use post_save
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 25 Jan 2018 23:01:26 +0000 (00:01 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 25 Jan 2018 23:01:26 +0000 (00:01 +0100)
teleforma/exam/models.py

index dd8a1820dddae88e63d7a7c6e78b1dbeba61abe5..4cb8cf0df75bc437d458ab5be04cde707e44ed16 100644 (file)
@@ -351,10 +351,6 @@ class Script(BaseResource):
             self.mark()
         if self.status == 0 and self.reject_reason:
             self.reject()
-        if not self.url:
-            self.uuid_link()
-        if not self.corrector:
-            self.submit()
         super(Script, self).save(*args, **kwargs)
 
     def update(self, *args, **kwargs):
@@ -493,13 +489,14 @@ def set_file_properties(sender, instance, **kwargs):
             instance.uuid_link()
         if not instance.corrector:
             instance.submit()
-        if hasattr(instance, 'image'):
-            if not instance.image:
-                path = cache_path + os.sep + instance.uuid + '.jpg'
-                command = 'convert ' + instance.file.path + ' ' + path
-                os.system(command)
-                instance.image = path
+        super(sender, instance).save()
+        # if hasattr(instance, 'image'):
+        #     if not instance.image:
+        #         path = cache_path + os.sep + instance.uuid + '.jpg'
+        #         command = 'convert ' + instance.file.path + ' ' + path
+        #         os.system(command)
+        #         instance.image = path
 
 
-post_save.connect(set_file_properties, sender=Script, dispatch_uid="script_post_save")
-post_save.connect(set_file_properties, sender=ScriptPage, dispatch_uid="scriptpage_post_save")
+post_save.connect(set_file_properties, sender=Script, dispatch_uid="script_post_save")
+post_save.connect(set_file_properties, sender=ScriptPage, dispatch_uid="scriptpage_post_save")