summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-04-10 00:21:51 +0100
committerVincent Breitmoser <look@my.amazin.horse>2018-04-10 11:35:29 +0200
commitd1e56cfcd11bcd509d8fa3954c00e06a84bddd87 (patch)
tree7454f2123896a06313435bd66b487a13e2aa5584 /synapse
parentUse psycopg2cffi module instead of psycopg2 if running on pypy (diff)
downloadsynapse-d1e56cfcd11bcd509d8fa3954c00e06a84bddd87.tar.xz
Fix pep8 error on psycopg2cffi hack
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/engines/__init__.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/synapse/storage/engines/__init__.py b/synapse/storage/engines/__init__.py
index be7f6d6ac3..8c868ece75 100644
--- a/synapse/storage/engines/__init__.py
+++ b/synapse/storage/engines/__init__.py
@@ -32,12 +32,11 @@ def create_engine(database_config):
     engine_class = SUPPORTED_MODULE.get(name, None)
 
     if engine_class:
-        needs_pypy_hack = (name == "psycopg2" and
-                platform.python_implementation() == "PyPy")
-        if needs_pypy_hack:
-            module = importlib.import_module("psycopg2cffi")
-        else:
-            module = importlib.import_module(name)
+        # pypy requires psycopg2cffi rather than psycopg2
+        if (name == "psycopg2" and
+                platform.python_implementation() == "PyPy"):
+            name = "psycopg2cffi"
+        module = importlib.import_module(name)
         return engine_class(module, database_config)
 
     raise RuntimeError(