[Python-checkins] r56965 - in tracker/instances/python-dev: extensions/local_replace.py html/issue.item.html html/msg.item.html

erik.forsberg python-checkins at python.org
Sun Aug 12 21:29:28 CEST 2007


Author: erik.forsberg
Date: Sun Aug 12 21:29:27 2007
New Revision: 56965

Added:
   tracker/instances/python-dev/extensions/local_replace.py
Modified:
   tracker/instances/python-dev/html/issue.item.html
   tracker/instances/python-dev/html/msg.item.html
Log:

Replace #<number> with a hyperlink to issue<number>, as proposed in
issue103.


Added: tracker/instances/python-dev/extensions/local_replace.py
==============================================================================
--- (empty file)
+++ tracker/instances/python-dev/extensions/local_replace.py	Sun Aug 12 21:29:27 2007
@@ -0,0 +1,18 @@
+import re
+
+substitutions = [ (re.compile('\#(?P<ws>\s*)(?P<id>\d+)'),
+                   "<a href='issue\g<id>'>#\g<ws>\g<id></a>" ),
+                  ]
+
+def localReplace(message):
+
+    for cre, replacement in substitutions:
+        message = cre.sub(replacement, message)
+
+    return message
+        
+    
+    
+def init(instance):
+    instance.registerUtil('localReplace', localReplace)
+    

Modified: tracker/instances/python-dev/html/issue.item.html
==============================================================================
--- tracker/instances/python-dev/html/issue.item.html	(original)
+++ tracker/instances/python-dev/html/issue.item.html	Sun Aug 12 21:29:27 2007
@@ -248,7 +248,7 @@
        Message has been classified as spam.
     </p>
     <pre tal:condition="python:msg.content.is_view_ok()"
-         tal:content="structure msg/content/hyperlinked">content</pre>
+         tal:content="structure python:utils.localReplace(msg.content.hyperlinked())">content</pre>
    </td>
   </tr>
  </tal:block>

Modified: tracker/instances/python-dev/html/msg.item.html
==============================================================================
--- tracker/instances/python-dev/html/msg.item.html	(original)
+++ tracker/instances/python-dev/html/msg.item.html	Sun Aug 12 21:29:27 2007
@@ -85,7 +85,7 @@
   <td class="content" colspan=2
       tal:condition="python:context.content.is_view_ok()">
       <pre
-      tal:content="structure context/content/hyperlinked"></pre></td>
+      tal:content="structure python:utils.localReplace(context.content.hyperlinked())"></pre></td>
   <td class="content" colspan=2
       tal:condition="python:not context.content.is_view_ok()">
             Message has been classified as spam and is therefore not


More information about the Python-checkins mailing list