From 0b007120d83cf12081a5f058573bffa4ab230843 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sat, 29 Aug 2020 15:38:29 +0200 Subject: [PATCH] fix code broken by previous commit --- respodns/db.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/respodns/db.py b/respodns/db.py index 0b8f573..9b474b8 100644 --- a/respodns/db.py +++ b/respodns/db.py @@ -3,7 +3,6 @@ from .sql import table_triggers from .tables import TException, TExecution, TAddress from .tables import TKind, TDomain, TRecord, TMessage from .ip_util import addr_to_int -import storm.locals as rain class Execution: @@ -23,11 +22,12 @@ class Execution: def is_column(ref): - return isinstance(ref, PropertyColumn) or isinstance(ref, rain.Reference) + from storm.properties import PropertyColumn + from storm.references import Reference + return isinstance(ref, PropertyColumn) or isinstance(ref, Reference) def apply_properties(obj, d): - from storm.properties import PropertyColumn for k, v in d.items(): ref = getattr(obj.__class__, k) assert ref is not None, (type(obj), k) @@ -38,9 +38,11 @@ def apply_properties(obj, d): class RespoDB: def __init__(self, uri, setup=False, create=False): + from storm.database import create_database + self.uri = uri db_exists = self._db_exists(self.uri) - self.db = rain.create_database(self.uri) + self.db = create_database(self.uri) self._conn = None if setup or (create and not db_exists): @@ -68,7 +70,8 @@ class RespoDB: return fp and exists(fp) def __enter__(self): - self._conn = rain.Store(self.db) + from storm.store import Store + self._conn = Store(self.db) return self def __exit__(self, exc_type, exc_value, traceback):