[xiph-commits] r3181 - cmmlwiki/trunk/cmmlwiki

shans at svn.annodex.net shans at svn.annodex.net
Sun Aug 12 18:51:14 PDT 2007


Author: shans
Date: 2007-08-12 18:51:14 -0700 (Sun, 12 Aug 2007)
New Revision: 3181

Modified:
   cmmlwiki/trunk/cmmlwiki/autocomplete.py
   cmmlwiki/trunk/cmmlwiki/clipdetails.py
   cmmlwiki/trunk/cmmlwiki/database.py
   cmmlwiki/trunk/cmmlwiki/embed.py
   cmmlwiki/trunk/cmmlwiki/handler.py
   cmmlwiki/trunk/cmmlwiki/itemmetadata.py
   cmmlwiki/trunk/cmmlwiki/play.py
   cmmlwiki/trunk/cmmlwiki/toc.py
Log:
Modifications to sql statements so that cmmlwiki works with python-pysqlite1.1 aas well as python-sqlite.  Thanks to Ken Yap for most of these patches.



Modified: cmmlwiki/trunk/cmmlwiki/autocomplete.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/autocomplete.py	2007-08-09 06:24:41 UTC (rev 3180)
+++ cmmlwiki/trunk/cmmlwiki/autocomplete.py	2007-08-13 01:51:14 UTC (rev 3181)
@@ -70,15 +70,15 @@
         l = len(iname)
         if (self.user_text.startswith(iname)):
             ixi = row['ixi']
-            sql = """SELECT clips.id FROM item_clips, clips
+            sql = """SELECT clips.id AS id FROM item_clips, clips
                      WHERE item_clips.ixi="%s"
                      AND item_clips.ixc=clips.ixc
                   """ % (ixi)
             self.inspector.cur.execute (sql)
             for idrow in self.inspector.cur.fetchall():
-                target = '%s?id=%s' % (iname, idrow['clips.id'])
+                target = '%s?id=%s' % (iname, idrow['id'])
                 if (target.startswith(self.user_text)):
-                    s += '<li>wiki:%s?id=%s</li>' % (xmlescape(iname), xmlescape(idrow['clips.id']))
+                    s += '<li>wiki:%s?id=%s</li>' % (xmlescape(iname), xmlescape(idrow['id']))
 
     s += '</ul>'
 

Modified: cmmlwiki/trunk/cmmlwiki/clipdetails.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/clipdetails.py	2007-08-09 06:24:41 UTC (rev 3180)
+++ cmmlwiki/trunk/cmmlwiki/clipdetails.py	2007-08-13 01:51:14 UTC (rev 3181)
@@ -31,8 +31,8 @@
 
     def clip_meta (row, field, label):
         s = '<li>'
-        i = InplaceEdit (iname, 'UpdateMeta', row['metas.ixm'], 'content',
-                         xmlescape(row['metas.content']), label,
+        i = InplaceEdit (iname, 'UpdateMeta', row['ixm'], 'content',
+                         xmlescape(row['content']), label,
                          editable=self.editable)
         s += i.template(vars)
         s += '</li>'
@@ -157,15 +157,15 @@
     # XXX: Should use vals
     #vals = {}
     #vals['ixc'] = self.ixc
-    sql = """SELECT metas.ixm, metas.name, metas.content
+    sql = """SELECT metas.ixm AS ixm, metas.name AS name, metas.content AS content
              FROM metas,clip_metas
              WHERE clip_metas.ixc="%s"
              AND metas.ixm=clip_metas.ixm""" % (self.ixc)
     self.inspector.cur.execute (sql)
     try:
       for row in self.inspector.cur.fetchall():
-        #print "<b>%s</b>: %s<br/>" % (row['metas.name'], row['metas.content'])
-        s += clip_meta (row, 'metas.content', row['metas.name'])
+        #print "<b>%s</b>: %s<br/>" % (row['name'], row['content'])
+        s += clip_meta (row, 'content', row['name'])
     except:
       pass
 

Modified: cmmlwiki/trunk/cmmlwiki/database.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/database.py	2007-08-09 06:24:41 UTC (rev 3180)
+++ cmmlwiki/trunk/cmmlwiki/database.py	2007-08-13 01:51:14 UTC (rev 3181)
@@ -42,13 +42,13 @@
         return row['name']
 
     def ixi2source(self, ixi):
-        sql = """SELECT sources.path FROM sources, item_sources
+        sql = """SELECT sources.path AS path FROM sources, item_sources
                  WHERE item_sources.ixi="%s"
                  AND item_sources.ixs = sources.ixs
               """ % (ixi)
         self.cur.execute(sql)
         row = self.cur.next()
-        return row['sources.path']
+        return row['path']
 
 # Update db_version
 def set_db_version (con, cur, version):

Modified: cmmlwiki/trunk/cmmlwiki/embed.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/embed.py	2007-08-09 06:24:41 UTC (rev 3180)
+++ cmmlwiki/trunk/cmmlwiki/embed.py	2007-08-13 01:51:14 UTC (rev 3181)
@@ -51,7 +51,7 @@
         var video = document.createElement("video");
         if( video.play )
         {
-            return true;
+            return false;
         }
         else
         {

Modified: cmmlwiki/trunk/cmmlwiki/handler.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/handler.py	2007-08-09 06:24:41 UTC (rev 3180)
+++ cmmlwiki/trunk/cmmlwiki/handler.py	2007-08-13 01:51:14 UTC (rev 3181)
@@ -64,14 +64,14 @@
 
     try:
         id = form['id'].value
-        sql = """SELECT clips.start_time FROM item_clips,clips
+        sql = """SELECT clips.start_time AS start_time FROM item_clips,clips
                  WHERE item_clips.ixc=clips.ixc
                  AND item_clips.ixi="%s"
                  AND clips.id="%s"
               """ % (self.ixi, id)
         self.inspector.cur.execute(sql)
         row = self.inspector.cur.next()
-        self.offset = (row['clips.start_time'])
+        self.offset = (row['start_time'])
     except KeyError:
         try:
             t = form['t'].value

Modified: cmmlwiki/trunk/cmmlwiki/itemmetadata.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/itemmetadata.py	2007-08-09 06:24:41 UTC (rev 3180)
+++ cmmlwiki/trunk/cmmlwiki/itemmetadata.py	2007-08-13 01:51:14 UTC (rev 3181)
@@ -53,14 +53,15 @@
       row = self.inspector.cur.fetchone()
       vals['ixh'] = row['ixh']
     
-      sql = """SELECT metas.ixm, metas.name, metas.content
+      sql = """SELECT metas.ixm AS ixm, metas.name AS name, 
+               metas.content AS content
                FROM metas,head_metas
                WHERE head_metas.ixh="%(ixh)s"
                AND metas.ixm=head_metas.ixm"""
       self.inspector.cur.execute (sql, vals)
       #try:
       for row in self.inspector.cur.fetchall():
-        s += item_meta (row, 'metas.content', row['metas.name'])
+        s += item_meta (row, 'content', row['name'])
 
       #except:
       #  pass

Modified: cmmlwiki/trunk/cmmlwiki/play.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/play.py	2007-08-09 06:24:41 UTC (rev 3180)
+++ cmmlwiki/trunk/cmmlwiki/play.py	2007-08-13 01:51:14 UTC (rev 3181)
@@ -50,7 +50,9 @@
     flush_headers()
 
     # Insert clips
-    sql = """SELECT clips.* FROM item_clips,clips
+    sql = """SELECT clips.a_text as a_text, clips.a_href as a_href,
+             clips.desc as desc, clips.start_time as start_time
+             FROM item_clips,clips
              WHERE item_clips.ixi='%s'
              AND item_clips.ixc=clips.ixc
              ORDER BY clips.start_time
@@ -59,10 +61,10 @@
     inspector.cur.execute(sql)
     for row in inspector.cur.fetchall():
         clip = annodex.Clip(anchor=annodex.Anchor(
-                        text="%(clips.a_text)s" % row,
-                        href="%(clips.a_href)s" % row), 
-                        desc=annodex.Desc(desc="%(clips.desc)s" % row))
-        anx.insert(clip, row['clips.start_time']);
+                        text="%(a_text)s" % row,
+                        href="%(a_href)s" % row), 
+                        desc=annodex.Desc(desc="%(desc)s" % row))
+        anx.insert(clip, row['start_time']);
 
     # Generate Annodex media
     while 1:

Modified: cmmlwiki/trunk/cmmlwiki/toc.py
===================================================================
--- cmmlwiki/trunk/cmmlwiki/toc.py	2007-08-09 06:24:41 UTC (rev 3180)
+++ cmmlwiki/trunk/cmmlwiki/toc.py	2007-08-13 01:51:14 UTC (rev 3181)
@@ -69,7 +69,7 @@
 #             ORDER BY clips.start_time LIMIT %d, %d
 #             """ % (self.ixi, self.start, limit)
 
-    sql = """SELECT clips.ixc FROM item_clips,clips
+    sql = """SELECT clips.ixc AS ixc FROM item_clips,clips
              WHERE item_clips.ixi='%s'
              AND item_clips.ixc=clips.ixc
              ORDER BY clips.start_time
@@ -77,7 +77,7 @@
 
     self.inspector.cur.execute(sql)
     for row in self.inspector.cur.fetchall():
-        s += ClipSummary (self.inspector, self.iname, row['clips.ixc'], editable=True).template(vars)
+        s += ClipSummary (self.inspector, self.iname, row['ixc'], editable=True).template(vars)
 
     cur = self.inspector.cur
     sql = """SELECT COUNT(*) FROM item_clips



More information about the commits mailing list