[cvs-annodex] commit (/annodex): cmmlwiki/trunk/view.cgi

conrad nobody at lists.annodex.net
Tue Apr 19 09:12:45 EST 2005


Update of /annodex (new revision 1273)

Modified files:
   cmmlwiki/trunk/view.cgi

Log Message:
user proper sax escaping, and disable <link> tag (not working with current AFE)


Modified: cmmlwiki/trunk/view.cgi
===================================================================
--- cmmlwiki/trunk/view.cgi	2005-04-18 11:13:45 UTC (rev 1272)
+++ cmmlwiki/trunk/view.cgi	2005-04-18 23:12:44 UTC (rev 1273)
@@ -7,6 +7,8 @@
 import sqlite
 import annodex
 
+from xml.sax.saxutils import escape
+
 db = "/var/local/lib/cmmlwiki/cmmlwiki.db"
 
 preamble = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@@ -44,6 +46,13 @@
     hh = ((it-(mm*60)-ss)/3600) % 60
     return "npt:%d:%02d:%02d.%03d" % (hh, mm, ss, ms)
 
+def my_escape (str):
+    try:
+        s = escape (str)
+    except AttributeError:
+        s = ''
+    return s
+
 def anxenc(ixp, id="", t=0.0):
     content_type ("application/x-annodex")
 
@@ -96,10 +105,6 @@
     def key_isprintable (dict, key):
         return (dict.has_key(key) and dict[key] != None and dict[key] != '')
 
-    def escape(str):
-        s = re.sub ("<", "&lt;", str)
-        return (re.sub (">", "&gt;", s))
-
     content_type ("text/x-cmml")
 
     print preamble
@@ -107,10 +112,10 @@
     print """<cmml>
 <head>
 <title>%s - CMML Wiki</title>
-<link rel="edit" href="%s/%s" />
 </head>
-""" % (project_name, edit_base, project_name)
-#""" % project_name
+""" % project_name
+#<link rel="edit" href="%s/%s" />
+#""" % (project_name, edit_base, project_name)
   
     con = sqlite.connect(db)
     cur = con.cursor()
@@ -132,7 +137,7 @@
             print '<img src="%(img_src)s"/>' % row
 
         if (key_isprintable (row, 'desc')):
-            print '<desc>%s</desc>' % escape(row['desc'])
+            print '<desc>%s</desc>' % my_escape(row['desc'])
 
         print '</clip>'
 


-- 
conrad



More information about the cvs-annodex mailing list