fix code broken by previous commit

This commit is contained in:
Connor Olding 2020-08-29 15:38:29 +02:00
parent bdb2a88f40
commit 0b007120d8

View File

@ -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):