diff roundup/backends/__init__.py @ 3718:0d561b24ceff

support sqlite3
author Richard Jones <richard@users.sourceforge.net>
date Wed, 04 Oct 2006 01:12:00 +0000
parents bcebddf1351f
children 6a96ad643629
line wrap: on
line diff
--- a/roundup/backends/__init__.py	Tue Oct 03 23:28:51 2006 +0000
+++ b/roundup/backends/__init__.py	Wed Oct 04 01:12:00 2006 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 #
-# $Id: __init__.py,v 1.36 2006-01-25 03:24:09 richard Exp $
+# $Id: __init__.py,v 1.37 2006-10-04 01:12:00 richard Exp $
 
 '''Container for the hyperdb storage backend implementations.
 '''
@@ -28,9 +28,10 @@
 # module name, have_backend quietly returns False.
 # Otherwise the error is reraised.
 _modules = {
-    'mysql': 'MySQLdb',
-    'postgresql': 'psycopg',
-    'tsearch2': 'psycopg',
+    'mysql': ('MySQLdb',),
+    'postgresql': ('psycopg',),
+    'tsearch2': ('psycopg',),
+    'sqlite': ('pysqlite', 'pysqlite2'),
 }
 
 def get_backend(name):
@@ -65,10 +66,10 @@
         get_backend(name)
         return 1
     except ImportError, e:
-        global _modules
-        if not str(e).startswith('No module named %s'
-                % _modules.get(name, name)):
-            raise
+        for name in _modules.get(name, (name,)):
+            if str(e).startswith('No module named %s'%name):
+                return 0
+        raise
     return 0
 
 def list_backends():

Roundup Issue Tracker: http://roundup-tracker.org/