]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
Quote URLs in hrefs
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 1 Sep 2009 08:56:54 +0000 (10:56 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 1 Sep 2009 08:56:54 +0000 (10:56 +0200)
tests/genhtml.py

index f6f55c58a4dcc6e1756fa79a0cac7534c066fa37..1302ad8f08da92d175bc9a806869f2e495bb8074 100755 (executable)
@@ -3,6 +3,7 @@
 import os;
 import dircache;
 import sys;
+import urllib
 
 os.chdir(sys.argv[1])
 
@@ -25,7 +26,7 @@ class Axis:
 
     def getLabel(self, v):
         if self.type == "clck": return v+" MHz"
-        elif self.type == "test": return "<a href='%s.sh.html'>%s</a>"%(v, v)
+        elif self.type == "test": return "<a href='%s.sh.html'>%s</a>"%(urllib.quote(v), v)
         else: return v
 
 
@@ -71,11 +72,11 @@ td { border: 1px solid lightgray; padding: 4px;}
         for ps in pagesets:
             print >>html, "View only %s: " % str(ps.values)
             for v in ps.values:
-                print >>html, "<a href='%s-%s.html'>%s</a> | "%(ps.values.type, v, v)
+                print >>html, "<a href='%s-%s.html'>%s</a> | "%(ps.values.type, urllib.quote(v), v)
             print >>html, "<br>"
         print >>html, "<table><thead><tr><td> </td>"
         for x in self.xvals.labels():
-            print >>html, "<td>%s</td>" % x
+            print >>html, "<th>%s</th>" % x
         print >>html, "</tr></thead>"
         for y in self.yvals:
             print >>html, "<tr><td>%s</td>" % self.yvals.getLabel(y)
@@ -86,7 +87,7 @@ td { border: 1px solid lightgray; padding: 4px;}
                 dthumb = d+"thumb"
                 try:
                     for img in dircache.listdir(dthumb):
-                        print >>html, "<a href='%s/%s'><img src='%s/thumb/%s'></a>" % (d, img, d, img)
+                        print >>html, "<a href='%s/%s'><img src='%s/thumb/%s'></a>" % (urllib.quote(d), img, urllib.quote(d), img)
                 except OSError:
                     print "warning: no images in %s?"%dthumb
                 print >>html, "</td>"