Permalink
Browse files

Merge "Import pysqlite2 if sqlite3 is not available."

  • Loading branch information...
2 parents 44e3c3e + d17dfe6 commit 7093c55d2e4722fc8ffdcef594cc5705b586a2d9 Jenkins committed with openstack-gerrit Dec 17, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 tests/test_import_legacy.py
@@ -16,8 +16,10 @@
import os
-import sqlite3
-#import sqlalchemy
+try:
+ import sqlite3 as dbapi
+except ImportError:
+ from pysqlite2 import dbapi2 as dbapi
from keystone.catalog.backends import templated as catalog_templated
from keystone.common.sql import legacy
@@ -52,7 +54,7 @@ def setup_old_database(self, sql_dump):
except OSError:
pass
script_str = open(sql_path).read().strip()
- conn = sqlite3.connect(db_path)
+ conn = dbapi.connect(db_path)
conn.executescript(script_str)
conn.commit()
return db_path

0 comments on commit 7093c55

Please sign in to comment.