[damned-lies] When getting reduced po_path, return non-reduced path if reduced does not exist



commit a6345a0ada65d2f5eed2b87b7b44dcae40b7f8c5
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Mar 19 10:29:02 2011 +0100

    When getting reduced po_path, return non-reduced path if reduced does not exist

 stats/models.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 2593ce1..f7662aa 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -1369,7 +1369,10 @@ class Statistics(models.Model):
         subdir = ""
         if self.domain.dtype == "doc":
             subdir = "docs"
-        return os.path.join(settings.POTDIR, self.module_name()+'.'+self.branch.name, subdir, self.filename(potfile, reduced))
+        path = os.path.join(settings.POTDIR, self.module_name()+'.'+self.branch.name, subdir, self.filename(potfile, reduced))
+        if reduced and not os.path.exists(path):
+            path = self.po_path(potfile=potfile, reduced=False)
+        return path
 
     def po_url(self, potfile=False, reduced=False):
         """ Return URL of po file, e.g. for downloading the file """



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