fix: always define app
attr for ViewSupplement
This commit is contained in:
parent
3f27f626df
commit
772b6610cb
|
@ -903,7 +903,7 @@ class MasterView(View):
|
|||
|
||||
def valid_employee_uuid(self, node, value):
|
||||
if value:
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
employee = self.Session.get(model.Employee, value)
|
||||
if not employee:
|
||||
node.raise_invalid("Employee not found")
|
||||
|
@ -939,7 +939,7 @@ class MasterView(View):
|
|||
|
||||
def valid_vendor_uuid(self, node, value):
|
||||
if value:
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
vendor = self.Session.get(model.Vendor, value)
|
||||
if not vendor:
|
||||
node.raise_invalid("Vendor not found")
|
||||
|
@ -1382,7 +1382,7 @@ class MasterView(View):
|
|||
return classes
|
||||
|
||||
def make_revisions_grid(self, obj, empty_data=False):
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
route_prefix = self.get_route_prefix()
|
||||
row_url = lambda txn, i: self.request.route_url(f'{route_prefix}.version',
|
||||
uuid=obj.uuid,
|
||||
|
@ -2153,7 +2153,7 @@ class MasterView(View):
|
|||
Thread target for executing an object.
|
||||
"""
|
||||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
session = app.make_session()
|
||||
obj = self.get_instance_for_key(key, session)
|
||||
user = session.get(model.User, user_uuid)
|
||||
|
@ -2594,7 +2594,7 @@ class MasterView(View):
|
|||
"""
|
||||
# nb. self.Session may differ, so use tailbone.db.Session
|
||||
session = Session()
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
route_prefix = self.get_route_prefix()
|
||||
|
||||
info = session.query(model.TailbonePageHelp)\
|
||||
|
@ -2617,7 +2617,7 @@ class MasterView(View):
|
|||
"""
|
||||
# nb. self.Session may differ, so use tailbone.db.Session
|
||||
session = Session()
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
route_prefix = self.get_route_prefix()
|
||||
|
||||
info = session.query(model.TailbonePageHelp)\
|
||||
|
@ -2639,7 +2639,7 @@ class MasterView(View):
|
|||
|
||||
# nb. self.Session may differ, so use tailbone.db.Session
|
||||
session = Session()
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
route_prefix = self.get_route_prefix()
|
||||
schema = colander.Schema()
|
||||
|
||||
|
@ -2673,7 +2673,7 @@ class MasterView(View):
|
|||
|
||||
# nb. self.Session may differ, so use tailbone.db.Session
|
||||
session = Session()
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
route_prefix = self.get_route_prefix()
|
||||
schema = colander.Schema()
|
||||
|
||||
|
@ -5541,7 +5541,7 @@ class MasterView(View):
|
|||
input_file_templates=True,
|
||||
output_file_templates=True):
|
||||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
names = []
|
||||
|
||||
if simple_settings is None:
|
||||
|
@ -6100,7 +6100,7 @@ class MasterView(View):
|
|||
renderer='json')
|
||||
|
||||
|
||||
class ViewSupplement(object):
|
||||
class ViewSupplement:
|
||||
"""
|
||||
Base class for view "supplements" - which are sort of like plugins
|
||||
which can "supplement" certain aspects of the view.
|
||||
|
@ -6127,6 +6127,7 @@ class ViewSupplement(object):
|
|||
def __init__(self, master):
|
||||
self.master = master
|
||||
self.request = master.request
|
||||
self.app = master.app
|
||||
self.model = master.model
|
||||
self.rattail_config = master.rattail_config
|
||||
self.Session = master.Session
|
||||
|
@ -6160,7 +6161,7 @@ class ViewSupplement(object):
|
|||
This is accomplished by subjecting the current base query to a
|
||||
join, e.g. something like::
|
||||
|
||||
model = self.model
|
||||
model = self.app.model
|
||||
query = query.outerjoin(model.MyExtension)
|
||||
return query
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue