Make CORE API client via app handler, not deprecated function
This commit is contained in:
parent
7b9b6e57e2
commit
ebdb658a2c
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -27,7 +27,6 @@ Handler for Vendor Catalog batches
|
|||
import decimal
|
||||
|
||||
from rattail.batch import vendorcatalog as base
|
||||
from rattail_corepos.corepos.api import make_corepos_api
|
||||
|
||||
|
||||
class VendorCatalogHandler(base.VendorCatalogHandler):
|
||||
|
@ -73,7 +72,7 @@ class VendorCatalogHandler(base.VendorCatalogHandler):
|
|||
if not vendor_id:
|
||||
raise ValueError("Batch vendor does not have valid CORE-POS ID")
|
||||
|
||||
self.api = make_corepos_api(self.config)
|
||||
self.api = self.get_corepos_handler.make_webapi()
|
||||
self.update_corepos(batch, rows, vendor_id, progress=progress,
|
||||
# update_product_costs=kwargs.get('update_product_costs', False),
|
||||
)
|
||||
|
|
|
@ -34,7 +34,6 @@ from rattail import commands
|
|||
from rattail_corepos import __version__
|
||||
from rattail.util import load_object
|
||||
from rattail_corepos.corepos.office.util import get_fannie_config_value
|
||||
from rattail_corepos.corepos.api import make_corepos_api
|
||||
from rattail_corepos.corepos.util import get_core_members
|
||||
from rattail_corepos.config import core_office_url
|
||||
|
||||
|
@ -91,10 +90,7 @@ class Anonymize(commands.Subcommand):
|
|||
"\tpip install names\n")
|
||||
sys.exit(2)
|
||||
|
||||
from rattail_corepos.corepos.api import make_corepos_api
|
||||
from rattail_corepos.corepos.util import get_core_members
|
||||
|
||||
api = make_corepos_api(self.config)
|
||||
api = self.app.get_corepos_handler().make_webapi()
|
||||
members = get_core_members(self.config, api, progress=self.progress)
|
||||
|
||||
def anonymize(member, i):
|
||||
|
@ -236,7 +232,7 @@ class PatchCustomerGaps(commands.Subcommand):
|
|||
def run(self, args):
|
||||
from corepos.db.office_op import model as corepos
|
||||
|
||||
corepos_api = make_corepos_api(self.config)
|
||||
corepos_api = self.app.get_corepos_handler().make_webapi()
|
||||
members = get_core_members(self.config, corepos_api, progress=self.progress)
|
||||
tally = self.app.make_object(updated=0)
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ CORE-POS model importers (webservices API)
|
|||
from rattail import importing
|
||||
from rattail.util import data_diffs
|
||||
from rattail_corepos.corepos.util import get_core_members
|
||||
from rattail_corepos.corepos.api import make_corepos_api
|
||||
|
||||
|
||||
class ToCOREAPIHandler(importing.ImportHandler):
|
||||
|
@ -83,7 +82,7 @@ class ToCoreAPI(importing.Importer):
|
|||
self.establish_api()
|
||||
|
||||
def establish_api(self):
|
||||
self.api = make_corepos_api(self.config)
|
||||
self.api = self.app.get_corepos_handler().make_webapi()
|
||||
|
||||
def ensure_fields(self, data):
|
||||
"""
|
||||
|
|
|
@ -29,7 +29,6 @@ from sqlalchemy import orm
|
|||
from corepos.db.office_op import Session as CoreSession, model as corepos
|
||||
|
||||
from rattail.datasync import DataSyncImportConsumer
|
||||
from rattail_corepos.corepos.api import make_corepos_api
|
||||
|
||||
|
||||
class FromCOREAPIToRattail(DataSyncImportConsumer):
|
||||
|
@ -42,11 +41,11 @@ class FromCOREAPIToRattail(DataSyncImportConsumer):
|
|||
}
|
||||
|
||||
def setup(self):
|
||||
super(FromCOREAPIToRattail, self).setup()
|
||||
super().setup()
|
||||
self.establish_api()
|
||||
|
||||
def establish_api(self):
|
||||
self.api = make_corepos_api(self.config)
|
||||
self.api = self.app.get_corepos_handler().make_webapi()
|
||||
|
||||
def pre_process_changes(self, session, changes):
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ from rattail.core import get_uuid
|
|||
from rattail.db.util import normalize_full_name
|
||||
from rattail_corepos import importing as corepos_importing
|
||||
from rattail_corepos.corepos.util import get_core_members
|
||||
from rattail_corepos.corepos.api import make_corepos_api
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -100,7 +99,7 @@ class FromCOREPOSAPI(importing.Importer):
|
|||
self.establish_api()
|
||||
|
||||
def establish_api(self):
|
||||
self.api = make_corepos_api(self.config)
|
||||
self.api = self.get_corepos_handler().make_webapi()
|
||||
|
||||
def should_ignore_new_members(self):
|
||||
if hasattr(self, 'ignore_new_members'):
|
||||
|
|
Loading…
Reference in a new issue