diff mercurial/hgweb.py @ 1650:f2ebd5251e88

changed template escape filter, added urlescape filter; audited all templates for insertion bugs; added note to manifest.py about newlines in filenames
author Peter van Dijk <peter@dataloss.nl>
date Sun, 29 Jan 2006 00:18:52 +0100
parents beb7da710c8a
children e8a3df8b62b3
line wrap: on
line diff
--- a/mercurial/hgweb.py	Sun Jan 29 11:17:54 2006 +1300
+++ b/mercurial/hgweb.py	Sun Jan 29 00:18:52 2006 +0100
@@ -6,7 +6,7 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-import os, cgi, sys
+import os, cgi, sys, urllib
 from demandload import demandload
 demandload(globals(), "mdiff time re socket zlib errno ui hg ConfigParser")
 demandload(globals(), "zipfile tempfile StringIO tarfile BaseHTTPServer util")
@@ -163,7 +163,8 @@
                 return
 
 common_filters = {
-    "escape": cgi.escape,
+    "escape": lambda x: cgi.escape(x, True),
+    "urlescape": urllib.quote,
     "strip": lambda x: x.strip(),
     "age": age,
     "date": lambda x: util.datestr(x),