[damned-lies] Provide for empty module.bugs_base
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Provide for empty module.bugs_base
- Date: Thu, 27 Apr 2017 11:39:00 +0000 (UTC)
commit 588df5166b2fad54847e2489ec078d344bd8e76c
Author: Claude Paroz <claude 2xlibre net>
Date: Thu Apr 27 13:38:21 2017 +0200
Provide for empty module.bugs_base
stats/models.py | 12 ++++++++----
templates/module_detail.html | 5 ++++-
2 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index d569a77..a3dd8ea 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -108,7 +108,7 @@ class Module(models.Model):
return re.search(settings.VCS_HOME_REGEX, self.vcs_root) is not None
def get_bugs_i18n_url(self, content=None):
- if "bugzilla" in self.bugs_base or "freedesktop" in self.bugs_base:
+ if self.bugs_base and ("bugzilla" in self.bugs_base or "freedesktop" in self.bugs_base):
link = utils.url_join(
self.bugs_base,
"buglist.cgi?product=%s&keywords_type=anywords&keywords=I18N+L10N"
@@ -120,7 +120,7 @@ class Module(models.Model):
return None
def get_bugs_enter_url(self):
- if "bugzilla" in self.bugs_base or "freedesktop" in self.bugs_base:
+ if self.bugs_base and ("bugzilla" in self.bugs_base or "freedesktop" in self.bugs_base):
link = utils.url_join(self.bugs_base, "enter_bug.cgi?product=%s&keywords=I18N+L10N" %
(self.bugs_product,))
if self.bugs_component:
link += "&component=%s" % self.bugs_component
@@ -832,7 +832,9 @@ class Domain(models.Model):
if kwds_vars:
pot_command.extend(kwds_vars.split())
# Added last as some chars in it may disturb CLI parsing
- pot_command.extend(['--msgid-bugs-address', self.module.get_bugs_enter_url()])
+ bugs_url = self.module.get_bugs_enter_url()
+ if bugs_url:
+ pot_command.extend(['--msgid-bugs-address', bugs_url])
elif self.pot_method.startswith(('http://', 'https://')):
# Get POT from URL and save file locally
@@ -847,7 +849,9 @@ class Domain(models.Model):
pot_command = ':' # noop
if 'intltool-update' in pot_command:
- env = {"XGETTEXT_ARGS": "\"--msgid-bugs-address=%s\"" % self.module.get_bugs_enter_url()}
+ bugs_url = self.module.get_bugs_enter_url()
+ if bugs_url:
+ env = {"XGETTEXT_ARGS": "\"--msgid-bugs-address=%s\"" % bugs_url}
if pot_command:
status, output, errs = utils.run_shell_command(pot_command, env=env, cwd=podir)
diff --git a/templates/module_detail.html b/templates/module_detail.html
index f9f3852..2c95530 100644
--- a/templates/module_detail.html
+++ b/templates/module_detail.html
@@ -70,8 +70,11 @@ $(document).ready(function() {
<ul>
{% if module.get_bugs_i18n_url %}
<li><a href="{{ module.get_bugs_i18n_url }}">{% trans "Show existing i18n and l10n bugs" %}</a></li>
- {% endif %}
+ {% elif module.get_bugs_enter_url %}
<li><a href="{{ module.get_bugs_enter_url }}">{% trans "Report a bug" %}</a></li>
+ {% else %}
+ <li><em>{% trans "Sorry, no known locations to report bugs for this module." %}</em></li>
+ {% endif %}
</ul>
{% endif %}
</div>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]