Set the model attr when making new AppHandler object

or at least try, and ignore errors, which will likely happen if
e.g. the DB layer is not installed
This commit is contained in:
Lance Edgar 2021-12-07 13:11:52 -06:00
parent bc3b9ea2f8
commit 611489fe59

View file

@ -66,6 +66,12 @@ class AppHandler(object):
def __init__(self, config):
self.config = config
# app may not use the db layer, but if so we set the model
try:
self.model = config.get_model()
except:
pass
def get_title(self, default=None):
return self.config.app_title(default=default)
@ -79,7 +85,7 @@ class AppHandler(object):
"""
import sqlalchemy as sa
model = self.config.get_model()
model = self.model
return session.query(model.Store)\
.filter(sa.or_(
model.Store.archived == False,