Make sure "configure" pages use AppHandler to save/delete settings

so that beaker config cache is invalidated, if in use
This commit is contained in:
Lance Edgar 2022-08-07 18:23:15 -05:00
parent 6352a6dc9a
commit fe4c3d4942
5 changed files with 45 additions and 33 deletions

View file

@ -436,15 +436,18 @@ class VendorCatalogView(FileBatchMasterView):
def configure_remove_settings(self):
super(VendorCatalogView, self).configure_remove_settings()
model = self.model
app = self.get_rattail_app()
names = [
'rattail.vendors.supported_catalog_parsers',
'tailbone.batch.vendorcatalog.supported_parsers', # deprecated
]
Session().query(model.Setting)\
.filter(model.Setting.name.in_(names))\
.delete(synchronize_session=False)
# nb. using thread-local session here; we do not use
# self.Session b/c it may not point to Rattail
session = Session()
for name in names:
app.delete_setting(session, name)
# TODO: deprecate / remove this