From b434fa108d2e5c65054380183130d168a5ae63f5 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 12 Feb 2023 09:34:38 -0600 Subject: [PATCH] More refactoring, `Query.get()` => `Session.get()` --- tailbone/views/custorders/batch.py | 24 ++++++++++-------------- tailbone/views/tempmon/dashboard.py | 3 +-- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/tailbone/views/custorders/batch.py b/tailbone/views/custorders/batch.py index 26ac5cde..38d2eda7 100644 --- a/tailbone/views/custorders/batch.py +++ b/tailbone/views/custorders/batch.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2021 Lance Edgar +# Copyright © 2010-2023 Lance Edgar # # This file is part of Rattail. # @@ -24,10 +24,6 @@ Base class for customer order batch views """ -from __future__ import unicode_literals, absolute_import - -import six - from rattail.db import model import colander @@ -152,12 +148,12 @@ class CustomerOrderBatchView(BatchMasterView): customer_display = "" if self.request.method == 'POST': if self.request.POST.get('customer_uuid'): - customer = self.Session.query(model.Customer)\ - .get(self.request.POST['customer_uuid']) + customer = self.Session.get(model.Customer, + self.request.POST['customer_uuid']) if customer: - customer_display = six.text_type(customer) + customer_display = str(customer) elif self.editing: - customer_display = six.text_type(order.customer or "") + customer_display = str(order.customer or "") customers_url = self.request.route_url('customers.autocomplete') f.set_widget('customer_uuid', forms.widgets.JQueryAutocompleteWidget( field_display=customer_display, service_url=customers_url)) @@ -172,12 +168,12 @@ class CustomerOrderBatchView(BatchMasterView): person_display = "" if self.request.method == 'POST': if self.request.POST.get('person_uuid'): - person = self.Session.query(model.Person)\ - .get(self.request.POST['person_uuid']) + person = self.Session.get(model.Person, + self.request.POST['person_uuid']) if person: - person_display = six.text_type(person) + person_display = str(person) elif self.editing: - person_display = six.text_type(order.person or "") + person_display = str(order.person or "") people_url = self.request.route_url('people.autocomplete') f.set_widget('person_uuid', forms.widgets.JQueryAutocompleteWidget( field_display=person_display, service_url=people_url)) @@ -194,7 +190,7 @@ class CustomerOrderBatchView(BatchMasterView): pending = batch.pending_customer if not pending: return - text = six.text_type(pending) + text = str(pending) url = self.request.route_url('pending_customers.view', uuid=pending.uuid) return tags.link_to(text, url) diff --git a/tailbone/views/tempmon/dashboard.py b/tailbone/views/tempmon/dashboard.py index f4d6ed16..515eabc9 100644 --- a/tailbone/views/tempmon/dashboard.py +++ b/tailbone/views/tempmon/dashboard.py @@ -66,8 +66,7 @@ class TempmonDashboardView(View): self.request.session[self.session_key] = selected_uuid if not selected_appliance and selected_uuid: - selected_appliance = TempmonSession.query(tempmon.Appliance)\ - .get(selected_uuid) + selected_appliance = TempmonSession.get(tempmon.Appliance, selected_uuid) context = { 'index_url': self.request.route_url('tempmon.appliances'),