More refactoring, Query.get()
=> Session.get()
This commit is contained in:
parent
f1496c771e
commit
b434fa108d
|
@ -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)
|
||||
|
||||
|
|
|
@ -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'),
|
||||
|
|
Loading…
Reference in a new issue