aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mediagoblin/db/open.py13
-rw-r--r--mediagoblin/db/util.py11
2 files changed, 20 insertions, 4 deletions
diff --git a/mediagoblin/db/open.py b/mediagoblin/db/open.py
index 32827fcb..6cd17869 100644
--- a/mediagoblin/db/open.py
+++ b/mediagoblin/db/open.py
@@ -14,5 +14,14 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from mediagoblin.db.mongo.open import \
- setup_connection_and_db_from_config, check_db_migrations_current
+try:
+ from mediagoblin.db.sql_switch import use_sql
+except ImportError:
+ use_sql = False
+
+if use_sql:
+ from mediagoblin.db.sql.open import \
+ setup_connection_and_db_from_config, check_db_migrations_current
+else:
+ from mediagoblin.db.mongo.open import \
+ setup_connection_and_db_from_config, check_db_migrations_current
diff --git a/mediagoblin/db/util.py b/mediagoblin/db/util.py
index 1df9494c..fff71d06 100644
--- a/mediagoblin/db/util.py
+++ b/mediagoblin/db/util.py
@@ -14,5 +14,12 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from mediagoblin.db.mongo.util import (ObjectId, InvalidId,
- DESCENDING)
+try:
+ from mediagoblin.db.sql_switch import use_sql
+except ImportError:
+ use_sql = False
+
+if use_sql:
+ from mediagoblin.db.sql.fake import ObjectId, InvalidId, DESCENDING
+else:
+ from mediagoblin.db.mongo.util import ObjectId, InvalidId, DESCENDING