]> git.parisson.com Git - teleforma.git/commitdiff
fix existing script new_abs path
authorGuillaume Pellerin <yomguy@parisson.com>
Sat, 19 Jul 2014 15:32:54 +0000 (17:32 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Sat, 19 Jul 2014 15:32:54 +0000 (17:32 +0200)
teleforma/exam/models.py

index 865ad457b8dabeb64c95e7452bccea3083025ac8..fe359bf62180c10e1b7633b0ac2dffcd8e119791 100644 (file)
@@ -293,6 +293,10 @@ class Script(BaseResource):
         new_abs = os.sep.join(old_abs_root) + os.sep + slugify(filename) + ext
         new_rel = os.sep.join(old_rel_root) + os.sep + slugify(filename) + ext
 
+        if os.path.exists(new_abs):
+            new_abs = os.sep.join(old_abs_root) + os.sep + slugify(filename) + '_' + unicode(self.uuid) + ext
+            new_rel = os.sep.join(old_rel_root) + os.sep + slugify(filename) + '_' + unicode(self.uuid) + ext
+
         os.rename(old_abs, new_abs)
         self.file = new_rel
         self.save()