support pysqlite2 in addition to the sqlite3 python module
authorTed Mielczarek <ted.mielczarek@gmail.com>
Fri, 13 Jun 2008 15:57:22 -0400
changeset 26 3e98a662394d9a45a33189604c562c6ec0cc1004
parent 25 904ea0ddd0b1475e6a0bbe5707ad5c5e6c4a9666
child 27 179a34439e3367743714ad24d76c4fa9b6a7c482
push id4
push usertmielczarek@mozilla.com
push dateFri, 13 Jun 2008 19:57:31 +0000
support pysqlite2 in addition to the sqlite3 python module
pushlog-feed.py
--- a/pushlog-feed.py
+++ b/pushlog-feed.py
@@ -1,16 +1,20 @@
 import mercurial.hgweb.protocol as hgwebprotocol
 from mercurial.templatefilters import xmlescape
 from mercurial.hgweb.common import HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
 from mercurial.node import short, bin
 import os.path
 import re
 import time
-import sqlite3 as sqlite
+
+try:
+    import sqlite3 as sqlite
+except ImportError:
+    from pysqlite2 import dbapi2 as sqlite
 
 def addwebcommand(f, name):
     setattr(hgwebprotocol, name, f)
     hgwebprotocol.__all__.append(name)
 
 ATOM_MIMETYPE = 'application/atom+xml'
 
 def lastNEntries(pushdb, n):