[damned-lies] Removed obsolete bugzilla_linkify filter
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Removed obsolete bugzilla_linkify filter
- Date: Sat, 16 Feb 2019 09:22:48 +0000 (UTC)
commit 6c474c93b3f87c41afac9c4b8dcd3200a9d7abd9
Author: Claude Paroz <claude 2xlibre net>
Date: Sat Feb 16 10:20:55 2019 +0100
Removed obsolete bugzilla_linkify filter
stats/templatetags/stats_extras.py | 13 -------------
stats/tests/tests.py | 11 -----------
templates/vertimus/vertimus_detail.html | 2 +-
3 files changed, 1 insertion(+), 25 deletions(-)
---
diff --git a/stats/templatetags/stats_extras.py b/stats/templatetags/stats_extras.py
index 0a812edf..e8f9f08d 100644
--- a/stats/templatetags/stats_extras.py
+++ b/stats/templatetags/stats_extras.py
@@ -240,19 +240,6 @@ def as_tr_cb(field):
field.name, field.as_widget(), field.name, label
)
-@register.filter
-def bugzilla_linkify(text):
- """Searches within the given text if a text matching a bugzilla bug
- reference is found and transforms it to a link to that bug"""
- # Should not catch encoded entities (')
- bug_id = re.compile('(?<!&)(?P<id>#[0-9]+)')
- repl = '<a rel="nofollow" href="https://bugzilla.gnome.org/show_bug.cgi?id=\g<id>">\g<id></a>'
-
- result = bug_id.sub(repl, text)
- result = result.replace('.cgi?id=#', '.cgi?id=')
- return mark_safe(result)
-
-
@register.filter(is_safe=True)
def markdown(value, arg=''):
"""
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index dc1cf6b8..b8582f9c 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -885,14 +885,3 @@ class OtherTests(TestCase):
response = self.client.get(reverse('releases', args=['json']))
content = json.loads(response.content.decode('utf-8'))
self.assertEqual(content[0]["fields"]["name"], "gnome-3-18")
-
- def test_bugzilla_linkify(self):
- from stats.templatetags.stats_extras import bugzilla_linkify
- self.assertEqual(bugzilla_linkify("Sample normal text should not be altered."),
- "Sample normal text should not be altered.")
- self.assertEqual(bugzilla_linkify("Bugzilla bug numbers like #669240 should be linkified"),
- 'Bugzilla bug numbers like <a rel="nofollow"
href="https://bugzilla.gnome.org/show_bug.cgi?id=669240">#669240</a> should be linkified')
- self.assertEqual(bugzilla_linkify("#669240 start or finish #669240"),
- '<a rel="nofollow" href="https://bugzilla.gnome.org/show_bug.cgi?id=669240">#669240</a> start or
finish <a rel="nofollow" href="https://bugzilla.gnome.org/show_bug.cgi?id=669240">#669240</a>')
- self.assertEqual(bugzilla_linkify("Test with encoded entities (rock'n roll) should not."),
- "Test with encoded entities (rock'n roll) should not.")
diff --git a/templates/vertimus/vertimus_detail.html b/templates/vertimus/vertimus_detail.html
index 93e9d35b..c69db2e6 100644
--- a/templates/vertimus/vertimus_detail.html
+++ b/templates/vertimus/vertimus_detail.html
@@ -238,7 +238,7 @@ $(document).ready(function() {
</div>
{% endif %}
{% if action.comment %}
- <p class="vertimus_action_comment">{{ action.comment|urlize|linebreaksbr|bugzilla_linkify }}</p>
+ <p class="vertimus_action_comment">{{ action.comment|urlize|linebreaksbr }}</p>
{% else %}
<p><em>{% trans "No comment" %}</em></p>
{% endif %}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]