[damned-lies] Catch error when pot file is not found



commit 4f4927e7ce4ccff1458c94c6471345f20e493d12
Author: Claude Paroz <claude 2xlibre net>
Date:   Tue Sep 1 10:10:41 2009 +0200

    Catch error when pot file is not found

 stats/views.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/stats/views.py b/stats/views.py
index 5f4bd0a..7a53b49 100644
--- a/stats/views.py
+++ b/stats/views.py
@@ -18,6 +18,7 @@
 # along with Damned Lies; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 from datetime import date
+import os
 
 from django.conf import settings
 from django.shortcuts import render_to_response, get_object_or_404
@@ -167,6 +168,8 @@ def dynamic_po(request, filename):
                              domain__name=domain,
                              language=None)
     file_path = potfile.po_path().encode('ascii')
+    if not os.access(file_path, os.X_OK):
+        raise Http404
 
     dyn_content = u"""# %(lang)s translation for %(pack)s.
 # Copyright (C) %(year)s %(pack)s's COPYRIGHT HOLDER



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