Some more tweaks to remove "buefy" references

mostly just docstring / comments but there were some code changes too
This commit is contained in:
Lance Edgar 2024-04-14 20:56:11 -05:00
parent ba521abf4f
commit d4089fbc6e
10 changed files with 42 additions and 45 deletions

View file

@ -1335,7 +1335,7 @@ class Grid(object):
def render_complete(self, template='/grids/complete.mako', **kwargs):
"""
Render the Buefy grid, complete with filters. Note that this also
Render the grid, complete with filters. Note that this also
includes the context menu items and grid tools.
"""
if 'grid_columns' not in kwargs:
@ -1437,7 +1437,7 @@ class Grid(object):
def get_filters_data(self):
"""
Returns a dict of current filters data, for use with Buefy grid view.
Returns a dict of current filters data, for use with index view.
"""
data = {}
for filtr in self.filters.values():
@ -1703,7 +1703,7 @@ class Grid(object):
def set_action_urls(self, row, rowobj, i):
"""
Pre-generate all action URLs for the given data row. Meant for use
with Buefy table, since we can't generate URLs from JS.
with client-side table, since we can't generate URLs from JS.
"""
for action in (self.main_actions + self.more_actions):
url = action.get_url(rowobj, i)

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar
# Copyright © 2010-2024 Lance Edgar
#
# This file is part of Rattail.
#
@ -178,9 +178,6 @@ def before_render(event):
renderer_globals['background_color'] = request.rattail_config.get(
'tailbone', 'background_color')
# TODO: remove this hack once nothing references it
renderer_globals['buefy_0_8'] = False
# maybe set custom stylesheet
css = None
if request.user:

View file

@ -171,9 +171,6 @@
:loading="loading"
:row-class="getRowClass"
## TODO: this should be more configurable, maybe auto-detect based
## on buefy version?? probably cannot do that, but this feature
## is only supported with buefy 0.8.13 and newer
% if request.rattail_config.getbool('tailbone', 'sticky_headers'):
sticky-header
height="600px"

View file

@ -202,7 +202,7 @@ class BatchMasterView(MasterView):
action_url=action_url,
component='upload-worksheet-form')
form.set_type('worksheet_file', 'file')
# TODO: must set these to avoid some default Buefy code
# TODO: must set these to avoid some default code
form.auto_disable = False
form.auto_disable_save = False
return form

View file

@ -145,9 +145,7 @@ class ImporterBatchView(BatchMasterView):
make_filter('object_key')
make_filter('object_str')
# for some reason we have to do this differently for Buefy?
kwargs = {}
make_filter('status_code', label="Status", **kwargs)
make_filter('status_code', label="Status")
g.filters['status_code'].set_choices(self.enum.IMPORTER_BATCH_ROW_STATUS)
def make_sorter(field):

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar
# Copyright © 2010-2024 Lance Edgar
#
# This file is part of Rattail.
#
@ -37,14 +37,14 @@ from tailbone import grids
from tailbone.db import Session
from tailbone.views import MasterView
from rattail.db import model
from rattail.db.model import Customer, CustomerShopper, PendingCustomer
class CustomerView(MasterView):
"""
Master view for the Customer class.
"""
model_class = model.Customer
model_class = Customer
is_contact = True
has_versions = True
results_downloadable = True
@ -251,6 +251,7 @@ class CustomerView(MasterView):
if instance:
return instance
model = self.model
key = self.request.matchdict['uuid']
# search by Customer.id
@ -270,7 +271,7 @@ class CustomerView(MasterView):
if instance:
return instance.customer
raise HTTPNotFound
raise self.notfound()
def configure_form(self, f):
super().configure_form(f)
@ -436,6 +437,7 @@ class CustomerView(MasterView):
return kwargs
def unique_id(self, node, value):
model = self.model
query = self.Session.query(model.Customer)\
.filter(model.Customer.id == value)
if self.editing:
@ -545,6 +547,7 @@ class CustomerView(MasterView):
def get_version_child_classes(self):
classes = super().get_version_child_classes()
model = self.model
classes.extend([
(model.CustomerGroupAssignment, 'customer_uuid'),
(model.CustomerPhoneNumber, 'parent_uuid'),
@ -556,6 +559,7 @@ class CustomerView(MasterView):
return classes
def detach_person(self):
model = self.model
customer = self.get_instance()
person = self.Session.get(model.Person, self.request.matchdict['person_uuid'])
if not person:
@ -651,9 +655,7 @@ class CustomerView(MasterView):
config.add_tailbone_permission(permission_prefix,
'{}.detach_person'.format(permission_prefix),
"Detach a Person from a {}".format(model_title))
# TODO: this should require POST, but we'll add that once
# we can assume a Buefy theme is present, to avoid having
# to implement the logic in old jquery...
# TODO: this should require POST!
config.add_route('{}.detach_person'.format(route_prefix),
'{}/detach-person/{{person_uuid}}'.format(instance_url_prefix),
# request_method='POST',
@ -667,7 +669,7 @@ class CustomerShopperView(MasterView):
"""
Master view for the CustomerShopper class.
"""
model_class = model.CustomerShopper
model_class = CustomerShopper
route_prefix = 'customer_shoppers'
url_prefix = '/customer-shoppers'
@ -748,7 +750,7 @@ class PendingCustomerView(MasterView):
"""
Master view for the Pending Customer class.
"""
model_class = model.PendingCustomer
model_class = PendingCustomer
route_prefix = 'pending_customers'
url_prefix = '/customers/pending'
@ -877,7 +879,7 @@ class PendingCustomerView(MasterView):
# TODO: this only works when creating, need to add edit support?
# TODO: can this just go away? since we have unique_id() view method above
def unique_id(node, value):
customers = Session.query(model.Customer).filter(model.Customer.id == value)
customers = Session.query(Customer).filter(Customer.id == value)
if customers.count():
raise colander.Invalid(node, "Customer ID must be unique")
@ -886,6 +888,8 @@ def customer_info(request):
"""
View which returns simple dictionary of info for a particular customer.
"""
app = request.rattail_config.get_app()
model = app.model
uuid = request.params.get('uuid')
customer = Session.get(model.Customer, uuid) if uuid else None
if not customer:

View file

@ -516,7 +516,7 @@ class SentView(MessageView):
class RecipientsWidgetBuefy(dfwidget.Widget):
"""
Custom "message recipients" widget, for use with Buefy / Vue.js themes.
Custom "message recipients" widget, for use with Vue.js themes.
"""
template = 'message_recipients'

View file

@ -1404,7 +1404,7 @@ class PersonView(MasterView):
"""
View which locates and organizes all relevant "transaction"
(version) history data for a given Person. Returns JSON, for
use with the Buefy table element on the full profile view.
use with the table element on the full profile view.
"""
person = self.get_instance()
versions = self.profile_revisions_collect(person)

View file

@ -1800,8 +1800,8 @@ class ProductView(MasterView):
def search(self):
"""
Perform a product search across multiple fields, and return
the results as JSON suitable for row data for a Buefy
``<b-table>`` component.
the results as JSON suitable for row data for a table
component.
"""
if 'term' not in self.request.GET:
# TODO: deprecate / remove this? not sure if/where it is used

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar
# Copyright © 2010-2024 Lance Edgar
#
# This file is part of Rattail.
#
@ -33,9 +33,7 @@ from collections import OrderedDict
import sqlalchemy as sa
from rattail.core import Object
from rattail.db import model, Session as RattailSession
from rattail.time import make_utc
from rattail.db.model import Upgrade
from rattail.threads import Thread
from deform import widget as dfwidget
@ -53,7 +51,7 @@ class UpgradeView(MasterView):
"""
Master view for all user events
"""
model_class = model.Upgrade
model_class = Upgrade
downloadable = True
cloneable = True
configurable = True
@ -100,7 +98,7 @@ class UpgradeView(MasterView):
]
def __init__(self, request):
super(UpgradeView, self).__init__(request)
super().__init__(request)
if hasattr(self, 'get_handler'):
warnings.warn("defining get_handler() is deprecated. please "
@ -120,7 +118,8 @@ class UpgradeView(MasterView):
return self.upgrade_handler
def configure_grid(self, g):
super(UpgradeView, self).configure_grid(g)
super().configure_grid(g)
model = self.model
# system
systems = self.upgrade_handler.get_all_systems()
@ -147,7 +146,8 @@ class UpgradeView(MasterView):
return 'notice'
def template_kwargs_view(self, **kwargs):
kwargs = super(UpgradeView, self).template_kwargs_view(**kwargs)
kwargs = super().template_kwargs_view(**kwargs)
model = self.model
upgrade = kwargs['instance']
kwargs['system_title'] = self.rattail_config.app_title()
@ -177,7 +177,7 @@ class UpgradeView(MasterView):
return kwargs
def configure_form(self, f):
super(UpgradeView, self).configure_form(f)
super().configure_form(f)
upgrade = f.model_instance
# system
@ -275,9 +275,10 @@ class UpgradeView(MasterView):
f.fields = ['system', 'description', 'notes', 'enabled']
def clone_instance(self, original):
app = self.get_rattail_app()
cloned = self.model_class()
cloned.system = original.system
cloned.created = make_utc()
cloned.created = app.make_utc()
cloned.created_by = self.request.user
cloned.description = original.description
cloned.notes = original.notes
@ -335,7 +336,6 @@ class UpgradeView(MasterView):
return HTML.tag('div', c="(not available for this upgrade)")
def get_extra_diff_row_attrs(self, field, attrs):
# note, this is only needed/used with Buefy
extra = {}
if attrs.get('class') != 'diff':
extra['v-show'] = "showingPackages == 'all'"
@ -449,13 +449,14 @@ class UpgradeView(MasterView):
return packages
def parse_requirement(self, line):
app = self.get_rattail_app()
match = re.match(r'^.*@(.*)#egg=(.*)$', line)
if match:
return Object(name=match.group(2), version=match.group(1))
return app.make_object(name=match.group(2), version=match.group(1))
match = re.match(r'^(.*)==(.*)$', line)
if match:
return Object(name=match.group(1), version=match.group(2))
return app.make_object(name=match.group(1), version=match.group(2))
def download_path(self, upgrade, filename):
return self.rattail_config.upgrade_filepath(upgrade.uuid, filename=filename)
@ -537,17 +538,17 @@ class UpgradeView(MasterView):
def delete_instance(self, upgrade):
self.handler.delete_files(upgrade)
super(UpgradeView, self).delete_instance(upgrade)
super().delete_instance(upgrade)
def configure_get_context(self, **kwargs):
context = super(UpgradeView, self).configure_get_context(**kwargs)
context = super().configure_get_context(**kwargs)
context['upgrade_systems'] = self.upgrade_handler.get_all_systems()
return context
def configure_gather_settings(self, data):
settings = super(UpgradeView, self).configure_gather_settings(data)
settings = super().configure_gather_settings(data)
keys = []
for system in json.loads(data['upgrade_systems']):
@ -568,7 +569,7 @@ class UpgradeView(MasterView):
return settings
def configure_remove_settings(self):
super(UpgradeView, self).configure_remove_settings()
super().configure_remove_settings()
app = self.get_rattail_app()
model = self.model