From 0e28a6ee2ba62496d985da7bfba165404c0293b1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 5 Dec 2021 17:24:54 -0600 Subject: [PATCH] Some tweaks to expose CORE <-> Rattail import handlers in web app --- rattail_corepos/corepos/importing/rattail.py | 4 ++-- rattail_corepos/corepos/lane/importing/op/office.py | 4 ++++ rattail_corepos/importing/corepos/api.py | 2 ++ rattail_corepos/importing/corepos/db.py | 2 ++ setup.py | 7 +++++++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/rattail_corepos/corepos/importing/rattail.py b/rattail_corepos/corepos/importing/rattail.py index 9a9833c..b0b9bf7 100644 --- a/rattail_corepos/corepos/importing/rattail.py +++ b/rattail_corepos/corepos/importing/rattail.py @@ -43,8 +43,8 @@ class FromRattailToCore(importing.FromRattailHandler): """ Rattail -> CORE-POS export handler """ - host_title = "Rattail" - local_title = "CORE-POS" + local_key = 'corepos_api' + generic_local_title = "CORE Office (API)" direction = 'export' def get_importers(self): diff --git a/rattail_corepos/corepos/lane/importing/op/office.py b/rattail_corepos/corepos/lane/importing/op/office.py index 5d31d03..ce3fd1c 100644 --- a/rattail_corepos/corepos/lane/importing/op/office.py +++ b/rattail_corepos/corepos/lane/importing/op/office.py @@ -38,6 +38,8 @@ class FromCoreOfficeHandler(FromSQLAlchemyHandler): """ Base class for import handlers which use CORE Office as the host. """ + host_key = 'corepos_db_office_op' + generic_host_title = 'CORE Office (DB "op")' host_title = "CORE Office" def make_host_session(self): @@ -50,6 +52,8 @@ class ToCoreLaneHandler(ToSQLAlchemyHandler): Base class for import handlers which target CORE Lane on the local side. """ local_title = "CORE Lane" + local_key = 'corepos_db_lane_op' + generic_local_title = 'CORE Lane (DB "op")' def make_session(self): return CoreLaneSession() diff --git a/rattail_corepos/importing/corepos/api.py b/rattail_corepos/importing/corepos/api.py index a762f2b..3071703 100644 --- a/rattail_corepos/importing/corepos/api.py +++ b/rattail_corepos/importing/corepos/api.py @@ -48,6 +48,8 @@ class FromCOREPOSToRattail(importing.ToRattailHandler): """ Import handler for data coming from a CORE POS API. """ + host_key = 'corepos_api' + generic_host_title = "CORE Office (API)" host_title = "CORE-POS (API)" def get_importers(self): diff --git a/rattail_corepos/importing/corepos/db.py b/rattail_corepos/importing/corepos/db.py index b66b43b..b5b25e8 100644 --- a/rattail_corepos/importing/corepos/db.py +++ b/rattail_corepos/importing/corepos/db.py @@ -38,6 +38,8 @@ class FromCOREPOSToRattail(importing.FromSQLAlchemyHandler, importing.ToRattailH """ Import handler for data coming from a CORE POS database. """ + generic_host_title = 'CORE Office (DB "op")' + host_key = 'corepos_db_office_op' corepos_dbkey = 'default' @property diff --git a/setup.py b/setup.py index 2d32337..43a7f48 100644 --- a/setup.py +++ b/setup.py @@ -123,6 +123,13 @@ setup( 'import-corepos-db = rattail_corepos.commands:ImportCOREPOSDB', ], + 'rattail.importing': [ + 'to_rattail.from_corepos_api = rattail_corepos.importing.corepos.api:FromCOREPOSToRattail', + 'to_rattail.from_corepos_db_office_op = rattail_corepos.importing.corepos.db:FromCOREPOSToRattail', + 'to_corepos_api.from_rattail = rattail_corepos.corepos.importing.rattail:FromRattailToCore', + 'to_corepos_db_lane_op.from_corepos_db_office_op = rattail_corepos.corepos.lane.importing.op.office:FromCoreOfficeToCoreLane', + ], + 'trainwreck.commands': [ 'import-corepos = rattail_corepos.trainwreck.commands:ImportCore', ],