[damned-lies] Fix xml generation for domain stats



commit 5e14f8f7e9db50cbc31af2696174c738d39727ac
Author: Claude Paroz <claude 2xlibre net>
Date:   Wed Mar 23 13:58:14 2011 +0100

    Fix xml generation for domain stats

 languages/tests/__init__.py |   29 +++++++++++++++++++++++++++++
 languages/views.py          |    6 +++---
 2 files changed, 32 insertions(+), 3 deletions(-)
---
diff --git a/languages/tests/__init__.py b/languages/tests/__init__.py
new file mode 100644
index 0000000..3b82d14
--- /dev/null
+++ b/languages/tests/__init__.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2011 Claude Paroz <claude 2xlibre net>
+#
+# This file is part of Damned Lies.
+#
+# Damned Lies is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Damned Lies is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Damned Lies; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from django.core.urlresolvers import reverse
+from django.test import TestCase
+
+class LanguageTestCase(TestCase):
+    fixtures = ['sample_data.json']
+
+    def testLanguageReleaseXML(self):
+        response = self.client.get(reverse("languages.views.language_release_xml", args=['fr', 'gnome-2-30']))
+        self.assertContains(response, """<stats language="fr" release="gnome-2-30">""")
diff --git a/languages/views.py b/languages/views.py
index 2bc8c40..78e3644 100644
--- a/languages/views.py
+++ b/languages/views.py
@@ -174,9 +174,9 @@ def get_domain_stats(mods, node_name):
         if dom_key == ' fake':
             continue
         content += "<%s id=\"%s\">" % (node_name, stat.domain.name)
-        content += "<translated>%s</translated>" % stat.translated
-        content += "<fuzzy>%s</fuzzy>" % stat.fuzzy
-        content += "<untranslated>%s</untranslated>" % stat.untranslated
+        content += "<translated>%s</translated>" % stat.translated()
+        content += "<fuzzy>%s</fuzzy>" % stat.fuzzy()
+        content += "<untranslated>%s</untranslated>" % stat.untranslated()
         content += "<pofile>%s</pofile>" % stat.po_url()
         content += "<svnpath>%s</svnpath>" % stat.vcs_web_path()
         content += "</%s>" % node_name



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