From a28a801a62ebd5f10036b9645357e6177d30c2bf Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 4 Mar 2022 12:32:16 -0600 Subject: [PATCH] Update some more view config syntax some common ones used by a particular app.. --- tailbone/views/employees.py | 9 ++++++++- tailbone/views/people.py | 15 +++++++++++++-- tailbone/views/products.py | 11 ++++++++++- tailbone/views/vendors/__init__.py | 7 ++++++- tailbone/views/vendors/core.py | 9 ++++++++- 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/tailbone/views/employees.py b/tailbone/views/employees.py index c1f4b01c..46375bb4 100644 --- a/tailbone/views/employees.py +++ b/tailbone/views/employees.py @@ -329,5 +329,12 @@ class EmployeeView(MasterView): "View *all* (not just current) {}".format(model_title_plural)) -def includeme(config): +def defaults(config, **kwargs): + base = globals() + + EmployeeView = kwargs.get('EmployeeView', base['EmployeeView']) EmployeeView.defaults(config) + + +def includeme(config): + defaults(config) diff --git a/tailbone/views/people.py b/tailbone/views/people.py index 3f055493..55f35927 100644 --- a/tailbone/views/people.py +++ b/tailbone/views/people.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2021 Lance Edgar +# Copyright © 2010-2022 Lance Edgar # # This file is part of Rattail. # @@ -1470,7 +1470,18 @@ class MergePeopleRequestView(MasterView): return "(person not found)" -def includeme(config): +def defaults(config, **kwargs): + base = globals() + + PersonView = kwargs.get('PersonView', base['PersonView']) PersonView.defaults(config) + + PersonNoteView = kwargs.get('PersonNoteView', base['PersonNoteView']) PersonNoteView.defaults(config) + + MergePeopleRequestView = kwargs.get('MergePeopleRequestView', base['MergePeopleRequestView']) MergePeopleRequestView.defaults(config) + + +def includeme(config): + defaults(config) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 33615ef4..145f55cb 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -2405,6 +2405,15 @@ class PendingProductView(MasterView): permission='{}.resolve_product'.format(permission_prefix)) -def includeme(config): +def defaults(config, **kwargs): + base = globals() + + ProductView = kwargs.get('ProductView', base['ProductView']) ProductView.defaults(config) + + PendingProductView = kwargs.get('PendingProductView', base['PendingProductView']) PendingProductView.defaults(config) + + +def includeme(config): + defaults(config) diff --git a/tailbone/views/vendors/__init__.py b/tailbone/views/vendors/__init__.py index 6a31777c..7d35780e 100644 --- a/tailbone/views/vendors/__init__.py +++ b/tailbone/views/vendors/__init__.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2021 Lance Edgar +# Copyright © 2010-2022 Lance Edgar # # This file is part of Rattail. # @@ -29,5 +29,10 @@ from __future__ import unicode_literals, absolute_import from .core import VendorView +def defaults(config, **kwargs): + from .core import defaults + return defaults(config, **kwargs) + + def includeme(config): config.include('tailbone.views.vendors.core') diff --git a/tailbone/views/vendors/core.py b/tailbone/views/vendors/core.py index 36280738..b3b003e7 100644 --- a/tailbone/views/vendors/core.py +++ b/tailbone/views/vendors/core.py @@ -180,5 +180,12 @@ class VendorView(MasterView): ] -def includeme(config): +def defaults(config, **kwargs): + base = globals() + + VendorView = kwargs.get('VendorView', base['VendorView']) VendorView.defaults(config) + + +def includeme(config): + defaults(config)