Index: /package_branches/invirt-web/cherrypy/code/main.py
===================================================================
--- /package_branches/invirt-web/cherrypy/code/main.py	(revision 2399)
+++ /package_branches/invirt-web/cherrypy/code/main.py	(revision 2400)
@@ -94,14 +94,4 @@
 checkpoint = Checkpoint()
 
-def jquote(string):
-    return "'" + string.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n') + "'"
-
-def helppopup(subj):
-    """Return HTML code for a (?) link to a specified help topic"""
-    return ('<span class="helplink"><a href="help?' +
-            cgi.escape(urllib.urlencode(dict(subject=subj, simple='true')))
-            +'" target="_blank" ' +
-            'onclick="return helppopup(' + cgi.escape(jquote(subj)) + ')">(?)</a></span>')
-
 def makeErrorPre(old, addition):
     if addition is None:
@@ -114,5 +104,4 @@
 Template.database = database
 Template.config = config
-Template.helppopup = staticmethod(helppopup)
 Template.err = None
 
Index: /package_branches/invirt-web/cherrypy/code/templates/functions.mako
===================================================================
--- /package_branches/invirt-web/cherrypy/code/templates/functions.mako	(revision 2399)
+++ /package_branches/invirt-web/cherrypy/code/templates/functions.mako	(revision 2400)
@@ -39,2 +39,12 @@
 % endif
 </%def>
+
+<%!
+def jquote(string):
+    return "'" + string.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n') + "'"
+%>
+
+<%def name="helppopup(subj)">
+## Return HTML code for a (?) link to a specified help topic
+<span class="helplink"><a href="help?simple=true;subject=${subj | u}" target="_blank" onclick="return helppopup(${subj | jquote,u})">(?)</a></span>
+</%def>
