From 6ef2e67f76a617fd65934d403f96a0d65bac13a3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 5 Oct 2023 11:53:12 -0500 Subject: [PATCH] Rename config section to `[corepos.db.office_arch]` to match module rename --- rattail_corepos/config.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/rattail_corepos/config.py b/rattail_corepos/config.py index 72c7cd1..c6cb8d2 100644 --- a/rattail_corepos/config.py +++ b/rattail_corepos/config.py @@ -63,12 +63,21 @@ class RattailCOREPOSExtension(ConfigExtension): config.coretrans_engines = engines config.coretrans_engine = engines.get('default') - # office_trans_archive - from corepos.db.office_trans_archive import Session - engines = get_engines(config, section='corepos.db.office_trans_archive') - config.core_office_trans_archive_engines = engines - config.core_office_trans_archive_engine = engines.get('default') - Session.configure(bind=config.core_office_trans_archive_engine) + # office_arch + from corepos.db.office_arch import Session + engines = get_engines(config, section='corepos.db.office_arch') + if not engines: + engines = get_engines(config, section='corepos.db.office_trans_archive') + if engines: + warnings.warn("config section [corepos.db.office_trans_archive] is deprecated; " + "please use section [corepos.db.office_arch] instead", + DeprecationWarning) + config.core_office_arch_engines = engines + config.core_office_arch_engine = engines.get('default') + # TODO: deprecate / remove these 2 + config.core_office_trans_archive_engines = config.core_office_arch_engines + config.core_office_trans_archive_engine = config.core_office_arch_engine + Session.configure(bind=config.core_office_arch_engine) # lane_op from corepos.db.lane_op import Session