From 82892be09657097dfdd7459a704cadc2db8eb3b9 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 12 Feb 2023 09:37:31 -0600 Subject: [PATCH] More refactoring, `Query.get()` => `Session.get()` --- rattail_corepos/datasync/corepos.py | 3 +-- rattail_corepos/datasync/rattail.py | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/rattail_corepos/datasync/corepos.py b/rattail_corepos/datasync/corepos.py index 78a0f1e..ed6d26f 100644 --- a/rattail_corepos/datasync/corepos.py +++ b/rattail_corepos/datasync/corepos.py @@ -235,8 +235,7 @@ class FromRattailToCore(DataSyncImportConsumer): self.invoke_importer(session, change) def get_host_object(self, session, change): - return session.query(getattr(model, change.payload_type))\ - .get(change.payload_key) + return session.get(getattr(model, change.payload_type), change.payload_key) def get_customers(self, session, change): diff --git a/rattail_corepos/datasync/rattail.py b/rattail_corepos/datasync/rattail.py index 49238a5..4a14441 100644 --- a/rattail_corepos/datasync/rattail.py +++ b/rattail_corepos/datasync/rattail.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2022 Lance Edgar +# Copyright © 2010-2023 Lance Edgar # # This file is part of Rattail. # @@ -185,5 +185,4 @@ class FromCOREPOSToRattailProducts(FromCOREPOSToRattailBase): else: # try to fetch CORE POS object via typical method Model = getattr(corepos, change.payload_type) - return self.corepos_session.query(Model)\ - .get(int(change.payload_key)) + return self.corepos_session.get(Model, int(change.payload_key))