[damned-lies] Take into account absence of POT file (no full_po for POT)
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Take into account absence of POT file (no full_po for POT)
- Date: Thu, 31 Mar 2011 12:27:35 +0000 (UTC)
commit 858df59c288842591b90cca9a7206d11b9751eb8
Author: Claude Paroz <claude 2xlibre net>
Date: Thu Mar 31 14:26:29 2011 +0200
Take into account absence of POT file (no full_po for POT)
stats/models.py | 4 +++-
templates/stats_show.html | 2 ++
2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 195d514..58f1760 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -342,7 +342,7 @@ class Branch(models.Model):
# Check if all mandatory languages are present
for lang in mandatory_langs:
for domain in stats.keys():
- if lang not in stats_langs[domain]:
+ if lang not in stats_langs[domain] and stats[domain][0].full_po:
fake_stat = FakeStatistics(self.module, self, typ, lang)
fake_stat.untranslated = stats[domain][0].untranslated()
stats[domain].append(fake_stat)
@@ -1321,6 +1321,8 @@ class Statistics(models.Model):
return "%s.%s.%spot" % (self.domain.potbase(), self.branch.name, reduced and "reduced." or "")
def pot_text(self):
+ if not self.full_po:
+ return _("POT file unavailable")
pot_size = self.full_po.pot_size()
fig_count = self.full_po.fig_count()
""" Return stat table header: 'POT file (n messages) - updated on ??-??-???? tz' """
diff --git a/templates/stats_show.html b/templates/stats_show.html
index 85632f5..75c4f74 100644
--- a/templates/stats_show.html
+++ b/templates/stats_show.html
@@ -11,7 +11,9 @@
<span class="path">{{ pot_stat.domain.directory }}</span>
{% endif %}
</h3>
+ {% if pot_stat.full_po %}
<a href="{{ pot_stat.po_url }}"><img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download POT file" %}" /></a>
+ {% endif %}
{{ pot_stat.pot_text }}
<!-- This is the title of the section that lists notices about a module -->
{% if pot_stat.informations %}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]