[damned-lies] Add links to search for and report bugs when POT files have errors (fixes #458314)
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Add links to search for and report bugs when POT files have errors (fixes #458314)
- Date: Thu, 10 Mar 2011 21:21:42 +0000 (UTC)
commit 4d08fb8f57b421269f318167b678ff035bcff492
Author: Claude Paroz <claude 2xlibre net>
Date: Thu Mar 10 22:17:39 2011 +0100
Add links to search for and report bugs when POT files have errors (fixes #458314)
Thanks to Adorilson Bezerra for the initial patch.
media/img/bug.png | Bin 0 -> 844 bytes
media/img/search.png | Bin 0 -> 996 bytes
stats/models.py | 25 +++++++++++++++++++------
stats/templatetags/stats_extras.py | 4 ++++
templates/stats_show.html | 14 ++++++++++++++
5 files changed, 37 insertions(+), 6 deletions(-)
---
diff --git a/media/img/bug.png b/media/img/bug.png
new file mode 100644
index 0000000..17ddf78
Binary files /dev/null and b/media/img/bug.png differ
diff --git a/media/img/search.png b/media/img/search.png
new file mode 100644
index 0000000..a20f45c
Binary files /dev/null and b/media/img/search.png differ
diff --git a/stats/models.py b/stats/models.py
index e9d5959..c9dca60 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -95,19 +95,24 @@ class Module(models.Model):
""" This function checks if the module is hosted in the standard VCS of the project """
return re.search(settings.VCS_HOME_REGEX, self.vcs_root) is not None
- def get_bugs_i18n_url(self):
+ def get_bugs_i18n_url(self, content=None):
if self.bugs_base.find("bugzilla") != -1 or self.bugs_base.find("freedesktop") != -1:
- return utils.url_join(self.bugs_base,
- "buglist.cgi?product=%s&keywords_type=anywords&keywords=I18N+L10N&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO" % (self.bugs_product,))
+ link = utils.url_join(
+ self.bugs_base,
+ "buglist.cgi?product=%s&keywords_type=anywords&keywords=I18N+L10N"
+ "&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO" % (self.bugs_product,))
+ if content:
+ link += "&content=%s" % content
+ return link
else:
return None
def get_bugs_enter_url(self):
if self.bugs_base.find("bugzilla") != -1 or self.bugs_base.find("freedesktop") != -1:
+ link = utils.url_join(self.bugs_base, "enter_bug.cgi?product=%s&keywords=I18N+L10N" % (self.bugs_product,))
if self.bugs_component:
- return utils.url_join(self.bugs_base, "enter_bug.cgi?product=%s&component=%s" % (self.bugs_product, self.bugs_component))
- else:
- return utils.url_join(self.bugs_base, "enter_bug.cgi?product=%s" % (self.bugs_product,))
+ link += "&component=%s" % self.bugs_component
+ return link
else:
return self.bugs_base
@@ -1562,6 +1567,14 @@ class Information(models.Model):
text = text.replace('%s',match,1)
return text
+ def report_bug_url(self):
+ link = self.statistics.branch.module.get_bugs_enter_url()
+ link += "&short_desc=%(short)s&content=%(short)s&comment=%(long)s" % {
+ 'short': "Error regenerating POT file",
+ 'long' : utils.stripHTML(self.get_description()),
+ }
+ return link
+
class InformationArchived(models.Model):
statistics = models.ForeignKey('StatisticsArchived')
# Priority of a stats message
diff --git a/stats/templatetags/stats_extras.py b/stats/templatetags/stats_extras.py
index b8e55c6..f786455 100644
--- a/stats/templatetags/stats_extras.py
+++ b/stats/templatetags/stats_extras.py
@@ -26,3 +26,7 @@ def escapeat(value):
@register.filter
def domain_type(stat):
return stat.domain.get_type(stat.branch)
+
+ register filter
+def browse_bugs(module, content):
+ return module.get_bugs_i18n_url(content)
diff --git a/templates/stats_show.html b/templates/stats_show.html
index eaf144e..492e81e 100644
--- a/templates/stats_show.html
+++ b/templates/stats_show.html
@@ -21,6 +21,20 @@
<tr>
<td valign="top"><img src="{{ msg.get_icon }}" alt="{{ msg.type }}" /></td>
<td>{{ msg.get_description|safe }}</td>
+ {% if user.is_authenticated %}
+ {% if msg.type == 'error' or msg.type == 'error-ext' %}
+ <td>
+ <a href='{{ module|browse_bugs:"error+pot+file" }}' target='_blank'>
+ <img src="{{ MEDIA_URL }}img/search.png" alt="{% trans "Search for similar bugs before reporting it" %}" title="{% trans "Search for similar bugs before reporting it" %}"/>
+ </a>
+ </td>
+ <td>
+ <a href='{{ msg.report_bug_url }}' target='_blank'>
+ <img src="{{ MEDIA_URL }}img/bug.png" alt="{% trans "Report this bug" %}" title="{% trans "Report this bug" %}"/>
+ </a>
+ </td>
+ {% endif %}
+ {% endif %}
</tr>
{% endfor %}
</table>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]