fix code broken by previous commit
This commit is contained in:
parent
bdb2a88f40
commit
0b007120d8
1 changed files with 8 additions and 5 deletions
|
@ -3,7 +3,6 @@ from .sql import table_triggers
|
||||||
from .tables import TException, TExecution, TAddress
|
from .tables import TException, TExecution, TAddress
|
||||||
from .tables import TKind, TDomain, TRecord, TMessage
|
from .tables import TKind, TDomain, TRecord, TMessage
|
||||||
from .ip_util import addr_to_int
|
from .ip_util import addr_to_int
|
||||||
import storm.locals as rain
|
|
||||||
|
|
||||||
|
|
||||||
class Execution:
|
class Execution:
|
||||||
|
@ -23,11 +22,12 @@ class Execution:
|
||||||
|
|
||||||
|
|
||||||
def is_column(ref):
|
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):
|
def apply_properties(obj, d):
|
||||||
from storm.properties import PropertyColumn
|
|
||||||
for k, v in d.items():
|
for k, v in d.items():
|
||||||
ref = getattr(obj.__class__, k)
|
ref = getattr(obj.__class__, k)
|
||||||
assert ref is not None, (type(obj), k)
|
assert ref is not None, (type(obj), k)
|
||||||
|
@ -38,9 +38,11 @@ def apply_properties(obj, d):
|
||||||
|
|
||||||
class RespoDB:
|
class RespoDB:
|
||||||
def __init__(self, uri, setup=False, create=False):
|
def __init__(self, uri, setup=False, create=False):
|
||||||
|
from storm.database import create_database
|
||||||
|
|
||||||
self.uri = uri
|
self.uri = uri
|
||||||
db_exists = self._db_exists(self.uri)
|
db_exists = self._db_exists(self.uri)
|
||||||
self.db = rain.create_database(self.uri)
|
self.db = create_database(self.uri)
|
||||||
self._conn = None
|
self._conn = None
|
||||||
|
|
||||||
if setup or (create and not db_exists):
|
if setup or (create and not db_exists):
|
||||||
|
@ -68,7 +70,8 @@ class RespoDB:
|
||||||
return fp and exists(fp)
|
return fp and exists(fp)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self._conn = rain.Store(self.db)
|
from storm.store import Store
|
||||||
|
self._conn = Store(self.db)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
|
Loading…
Reference in a new issue