changeset 3398:1ca82b6a6349 beta

urlify commit function also should extract normal links
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 25 Feb 2013 17:55:18 +0100
parents 64c194492aad
children 5ff79fad209c 79c980b628e3
files rhodecode/lib/helpers.py
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py	Mon Feb 25 17:16:45 2013 +0100
+++ b/rhodecode/lib/helpers.py	Mon Feb 25 17:55:18 2013 +0100
@@ -978,6 +978,11 @@
 
 
 def urlify_text(text_):
+    """
+    Extrac urls from text and make html links out of them
+
+    :param text_:
+    """
 
     url_pat = re.compile(r'''(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]'''
                          '''|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)''')
@@ -994,7 +999,7 @@
     Extract revision ids from changeset and make link from them
 
     :param text_:
-    :param repository:
+    :param repository: repo name to build the URL with
     """
     from pylons import url  # doh, we need to re-import url to mock it later
     URL_PAT = re.compile(r'(?:^|\s)([0-9a-fA-F]{12,40})(?:$|\s)')
@@ -1037,6 +1042,7 @@
     :param link_: changeset link
     """
     import traceback
+    from pylons import url  # doh, we need to re-import url to mock it later
 
     def escaper(string):
         return string.replace('<', '&lt;').replace('>', '&gt;')
@@ -1055,6 +1061,9 @@
     # urlify changesets - extrac revisions and make link out of them
     newtext = urlify_changesets(escaper(text_), repository)
 
+    # extract http/https links and make them real urls
+    newtext = urlify_text(newtext)
+
     try:
         from rhodecode import CONFIG
         conf = CONFIG