[damned-lies] Defined already_exist after checking out the branch



commit f2095ebceb2e7022905a086e988e50be519c6b56
Author: Claude Paroz <claude 2xlibre net>
Date:   Mon Feb 24 13:38:00 2014 +0100

    Defined already_exist after checking out the branch
    
    Fixes bug #725007, thanks GunChleoc for the report.

 stats/models.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 82458db..b52843d 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -667,7 +667,6 @@ class Branch(models.Model):
         prefix = '' if domain.dtype == 'ui' else locale
         dest_filename = os.path.join(prefix, "%s.po" % locale)
         dest_path = os.path.join(commit_dir, dest_filename)
-        already_exist = os.access(dest_path, os.F_OK)
 
         if vcs_type == "git":
             var_dict = {
@@ -678,8 +677,6 @@ class Branch(models.Model):
                 'author': author,
                 'msg':     "Updated %s translation" % language.name,
             }
-            if not already_exist and domain.dtype != 'ui':
-                raise Exception("Sorry, adding new translations for documentation is not yet supported.")
 
             with ModuleLock(self.module):
                 utils.run_shell_command(
@@ -687,6 +684,10 @@ class Branch(models.Model):
                 utils.run_shell_command(
                     "cd \"%(dest)s\" && git pull" % var_dict, raise_on_error=True)
 
+                already_exist = os.access(dest_path, os.F_OK)
+                if not already_exist and domain.dtype != 'ui':
+                    raise Exception("Sorry, adding new translations for documentation is not yet supported.")
+
                 # Copy file in repo
                 utils.copy_file(po_file, dest_path)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]