Honor configured db key sequence; let config hide some db keys from UI

This commit is contained in:
Lance Edgar 2019-10-12 13:34:00 -05:00
parent 3dd70926b9
commit acda689b15
2 changed files with 12 additions and 12 deletions

View file

@ -2417,12 +2417,12 @@ class MasterView(View):
supported database engines for the master view. Used with the DB
picker feature.
"""
engines = OrderedDict()
if self.rattail_config.rattail_engine:
engines['default'] = self.rattail_config.rattail_engine
for dbkey in sorted(self.rattail_config.rattail_engines):
if dbkey != 'default':
engines[dbkey] = self.rattail_config.rattail_engines[dbkey]
engines = OrderedDict(self.rattail_config.trainwreck_engines)
hidden = self.rattail_config.getlist('tailbone', 'engines.rattail.hidden',
default=None)
if hidden:
for key in hidden:
engines.pop(key, None)
return engines
##############################

View file

@ -131,12 +131,12 @@ class TransactionView(MasterView):
]
def get_db_engines(self):
engines = OrderedDict()
if self.rattail_config.trainwreck_engine:
engines['default'] = self.rattail_config.trainwreck_engine
for dbkey in sorted(self.rattail_config.trainwreck_engines):
if dbkey != 'default':
engines[dbkey] = self.rattail_config.trainwreck_engines[dbkey]
engines = OrderedDict(self.rattail_config.trainwreck_engines)
hidden = self.rattail_config.getlist('tailbone', 'engines.trainwreck.hidden',
default=None)
if hidden:
for key in hidden:
engines.pop(key, None)
return engines
def configure_grid(self, g):