diff rhodecode/lib/helpers.py @ 2111:122f15a8f6ec beta

fixed issue with escaping < and > in changeset commits
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 07 Mar 2012 05:26:33 +0200
parents 8ecfed1d8f8b
children 2f2695771579
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py	Wed Mar 07 05:15:33 2012 +0200
+++ b/rhodecode/lib/helpers.py	Wed Mar 07 05:26:33 2012 +0200
@@ -802,6 +802,12 @@
 
 
 def urlify_changesets(text_, repository):
+    """
+    Extract revision ids from changeset and make link from them
+    
+    :param text_:
+    :param repository:
+    """
     import re
     URL_PAT = re.compile(r'([0-9a-fA-F]{12,})')
 
@@ -839,10 +845,10 @@
     """
     import re
     import traceback
-
-    # urlify changesets
-    text_ = urlify_changesets(text_, repository)
-
+    
+    def escaper(string):
+        return string.replace('<', '&lt;').replace('>', '&gt;')
+    
     def linkify_others(t, l):
         urls = re.compile(r'(\<a.*?\<\/a\>)',)
         links = []
@@ -853,6 +859,11 @@
                 links.append(e)
 
         return ''.join(links)
+    
+    
+    # urlify changesets - extrac revisions and make link out of them
+    text_ = urlify_changesets(escaper(text_), repository)
+
     try:
         conf = config['app_conf']