[Secure-testing-commits] r28796 - lib/python
Holger Levsen
holger at moszumanska.debian.org
Mon Sep 15 18:01:35 UTC 2014
Author: holger
Date: 2014-09-15 18:01:35 +0000 (Mon, 15 Sep 2014)
New Revision: 28796
Modified:
lib/python/web_support.py
Log:
Show URLs in TODO/NOTE as hyperlinks in the web view. (Closes: #610220)
Modified: lib/python/web_support.py
===================================================================
--- lib/python/web_support.py 2014-09-15 17:47:23 UTC (rev 28795)
+++ lib/python/web_support.py 2014-09-15 18:01:35 UTC (rev 28796)
@@ -453,12 +453,21 @@
def make_pre(lines):
"""Creates a pre-formatted text area."""
- r = []
- append = r.append
- for l in lines:
- append(l)
- append('\n')
- return tag('pre', ''.join(r))
+ pre = []
+ append = pre.append
+ for line in lines:
+ # turn https:// and http:// into links
+ results=re.search("(.*)(?P<url>https?://[^\s]+)(.*)", line)
+ if results:
+ for group in results.groups():
+ if group.startswith('http://') or group.startswith('https://'):
+ append(A(group))
+ else:
+ append(group)
+ else:
+ append(line)
+ append(BR())
+ return tag('pre', pre)
def make_menu(convert, *entries):
"""Creates an unnumbered list of hyperlinks.
More information about the Secure-testing-commits
mailing list