[damned-lies] Fixes #127 - Simplified dynamic po file name



commit b7cb9a71bc23426926eb6e63573ff576f15cd98f
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Feb 16 09:32:40 2019 +0100

    Fixes #127 - Simplified dynamic po file name

 stats/tests/tests.py | 11 ++++++++++-
 stats/views.py       |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index 0a708694..d5027dea 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -297,14 +297,23 @@ class ModuleTestCase(TestCase):
         )
         dyn_url = FakeLangStatistics(pot_stats, tamil).po_url()
         response = self.client.get(dyn_url)
+        self.assertEqual(
+            response['content-disposition'],
+            'inline; filename=gnome-hello.master.ta.po'
+        )
         self.assertContains(response, """# Tamil translation for gnome-hello.
 # Copyright (C) %s gnome-hello's COPYRIGHT HOLDER
 # This file is distributed under the same license as the gnome-hello package.
 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.""" % date.today().year)
         self.assertContains(response, "Language-Team: Tamil <ta li org>")
+
         dyn_url = FakeLangStatistics(pot_stats, tamil).po_url(reduced=True)
         response = self.client.get(dyn_url)
-        self.assertContains(response, """# Tamil translation for gnome-hello.""")
+        self.assertEqual(
+            response['content-disposition'],
+            'inline; filename=gnome-hello.master.ta-reduced.po'
+        )
+        self.assertContains(response, '# Tamil translation for gnome-hello.')
 
     @test_scratchdir
     def test_commit_ability(self):
diff --git a/stats/views.py b/stats/views.py
index b69a6793..702da43b 100644
--- a/stats/views.py
+++ b/stats/views.py
@@ -252,7 +252,7 @@ def dynamic_po(request, module_name, branch_name, domain_name, filename):
             break
     response = HttpResponse(dyn_content, 'text/plain')
     response['Content-Disposition'] = 'inline; filename=%s' % (
-        ".".join([module_name, domain.name, branch_name, filename]))
+        ".".join([domain.potbase(), branch_name, filename]))
     return response
 
 def releases(request, format='html'):


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