From 1afc70e788a650ccb4e29d984b008bd307fa6211 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 4 Jun 2024 22:11:51 -0500 Subject: [PATCH 001/214] Remove old/unused scaffold for use with `pcreate` we now have a better Generate Project feature --- setup.cfg | 3 --- tailbone/scaffolds.py | 45 ------------------------------------------- 2 files changed, 48 deletions(-) delete mode 100644 tailbone/scaffolds.py diff --git a/setup.cfg b/setup.cfg index 5f46bc5c..6184c7c2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -98,6 +98,3 @@ rattail.cleaners = rattail.config.extensions = tailbone = tailbone.config:ConfigExtension - -pyramid.scaffold = - rattail = tailbone.scaffolds:RattailTemplate diff --git a/tailbone/scaffolds.py b/tailbone/scaffolds.py deleted file mode 100644 index 10bf9640..00000000 --- a/tailbone/scaffolds.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -################################################################################ -# -# Rattail -- Retail Software Framework -# Copyright © 2010-2017 Lance Edgar -# -# This file is part of Rattail. -# -# Rattail is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# Rattail. If not, see . -# -################################################################################ -""" -Pyramid scaffold templates -""" - -from __future__ import unicode_literals, absolute_import - -from rattail.files import resource_path -from rattail.util import prettify - -from pyramid.scaffolds import PyramidTemplate - - -class RattailTemplate(PyramidTemplate): - _template_dir = resource_path('rattail:data/project') - summary = "Starter project based on Rattail / Tailbone" - - def pre(self, command, output_dir, vars): - """ - Adds some more variables to the template context. - """ - vars['project_title'] = prettify(vars['project']) - vars['package_title'] = vars['package'].capitalize() - return super(RattailTemplate, self).pre(command, output_dir, vars) From d9911cf23d5864a772d83777c0605c7040382120 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 5 Jun 2024 23:04:45 -0500 Subject: [PATCH 002/214] Add 'fanstatic' support for sake of libcache assets for vue.js and oruga etc. we don't want to include files in tailbone since they are apt to change over time, and probably need to use different versions for different apps etc. much may need to change yet, this is a first attempt but so far it seems quite promising --- setup.cfg | 1 + tailbone/app.py | 2 ++ tailbone/util.py | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/setup.cfg b/setup.cfg index 6184c7c2..50c057f9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,6 +57,7 @@ install_requires = pyramid_beaker pyramid_deform pyramid_exclog + pyramid_fanstatic pyramid_mako pyramid_retry pyramid_tm diff --git a/tailbone/app.py b/tailbone/app.py index 5ca4c5c9..b0160bd3 100644 --- a/tailbone/app.py +++ b/tailbone/app.py @@ -129,6 +129,7 @@ def make_pyramid_config(settings, configure_csrf=True): # we want the new themes feature! establish_theme(settings) + settings.setdefault('fanstatic.versioning', 'true') settings.setdefault('pyramid_deform.template_search_path', 'tailbone:templates/deform') config = Configurator(settings=settings, root_factory=Root) @@ -147,6 +148,7 @@ def make_pyramid_config(settings, configure_csrf=True): # Bring in some Pyramid goodies. config.include('tailbone.beaker') config.include('pyramid_deform') + config.include('pyramid_fanstatic') config.include('pyramid_mako') config.include('pyramid_tm') diff --git a/tailbone/util.py b/tailbone/util.py index 7d838541..9a993176 100644 --- a/tailbone/util.py +++ b/tailbone/util.py @@ -25,6 +25,7 @@ Utilities """ import datetime +import importlib import logging import warnings @@ -195,6 +196,12 @@ def get_liburl(request, key, fallback=True): version = get_libver(request, key) + static = config.get('tailbone.static_libcache.module') + if static: + static = importlib.import_module(static) + needed = request.environ['fanstatic.needed'] + liburl = needed.library_url(static.libcache) + '/' + if key == 'buefy': return 'https://unpkg.com/buefy@{}/dist/buefy.min.js'.format(version) @@ -211,24 +218,38 @@ def get_liburl(request, key, fallback=True): return 'https://use.fontawesome.com/releases/v{}/js/all.js'.format(version) elif key == 'bb_vue': + if static and hasattr(static, 'bb_vue_js'): + return liburl + static.bb_vue_js.relpath return f'https://unpkg.com/vue@{version}/dist/vue.esm-browser.prod.js' elif key == 'bb_oruga': + if static and hasattr(static, 'bb_oruga_js'): + return liburl + static.bb_oruga_js.relpath return f'https://unpkg.com/@oruga-ui/oruga-next@{version}/dist/oruga.mjs' elif key == 'bb_oruga_bulma': + if static and hasattr(static, 'bb_oruga_bulma_js'): + return liburl + static.bb_oruga_bulma_js.relpath return f'https://unpkg.com/@oruga-ui/theme-bulma@{version}/dist/bulma.mjs' elif key == 'bb_oruga_bulma_css': + if static and hasattr(static, 'bb_oruga_bulma_css'): + return liburl + static.bb_oruga_bulma_css.relpath return f'https://unpkg.com/@oruga-ui/theme-bulma@{version}/dist/bulma.css' elif key == 'bb_fontawesome_svg_core': + if static and hasattr(static, 'bb_fontawesome_svg_core_js'): + return liburl + static.bb_fontawesome_svg_core_js.relpath return f'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-svg-core@{version}/+esm' elif key == 'bb_free_solid_svg_icons': + if static and hasattr(static, 'bb_free_solid_svg_icons_js'): + return liburl + static.bb_free_solid_svg_icons_js.relpath return f'https://cdn.jsdelivr.net/npm/@fortawesome/free-solid-svg-icons@{version}/+esm' elif key == 'bb_vue_fontawesome': + if static and hasattr(static, 'bb_vue_fontawesome_js'): + return liburl + static.bb_vue_fontawesome_js.relpath return f'https://cdn.jsdelivr.net/npm/@fortawesome/vue-fontawesome@{version}/+esm' From ce290f5f8b400ba0dc2fa5ec51a145d74adf7a8b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 6 Jun 2024 15:30:48 -0500 Subject: [PATCH 003/214] Update changelog --- CHANGES.rst | 8 ++++++++ tailbone/_version.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index c6809592..cc04273e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,14 @@ CHANGELOG Unreleased ---------- +0.10.13 (2024-06-06) +-------------------- + +* Remove old/unused scaffold for use with ``pcreate``. + +* Add 'fanstatic' support for sake of libcache assets. + + 0.10.12 (2024-06-04) -------------------- diff --git a/tailbone/_version.py b/tailbone/_version.py index 2af82b6d..1daf8e32 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.10.12' +__version__ = '0.10.13' From f6f2a53a0c7a542ead7bb5dc9a8414e6057ed774 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 6 Jun 2024 20:33:36 -0500 Subject: [PATCH 004/214] Use `pkg_resources` to determine package versions and always add `app_version` to global template context. this was for sake of "About This App v1.0.0" style links in custom page footers --- tailbone/subscribers.py | 5 +++++ tailbone/views/common.py | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index 42d3cab7..59ef64dc 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -28,6 +28,7 @@ import six import json import datetime import logging +import pkg_resources import warnings from collections import OrderedDict @@ -168,7 +169,11 @@ def before_render(event): renderer_globals = event renderer_globals['rattail_app'] = request.rattail_config.get_app() + renderer_globals['app_title'] = request.rattail_config.app_title() + pkg = rattail_config.app_package() + renderer_globals['app_version'] = pkg_resources.get_distribution(pkg).version + renderer_globals['h'] = helpers renderer_globals['url'] = request.route_url renderer_globals['rattail'] = rattail diff --git a/tailbone/views/common.py b/tailbone/views/common.py index 266561fd..58346f3b 100644 --- a/tailbone/views/common.py +++ b/tailbone/views/common.py @@ -24,8 +24,8 @@ Various common views """ -import importlib import os +import pkg_resources from collections import OrderedDict from rattail.batch import consume_batch_id @@ -108,8 +108,7 @@ class CommonView(View): return self.project_version pkg = self.rattail_config.app_package() - mod = importlib.import_module(pkg) - return mod.__version__ + return pkg_resources.get_distribution(pkg).version def exception(self): """ From 0491d8517c59379bf6e272ba1dc93245e6c82930 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 6 Jun 2024 23:04:47 -0500 Subject: [PATCH 005/214] Update changelog --- CHANGES.rst | 6 ++++++ tailbone/_version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index cc04273e..178135e4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,12 @@ CHANGELOG Unreleased ---------- +0.10.14 (2024-06-06) +-------------------- + +* Use ``pkg_resources`` to determine package versions. + + 0.10.13 (2024-06-06) -------------------- diff --git a/tailbone/_version.py b/tailbone/_version.py index 1daf8e32..7a64f8d0 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.10.13' +__version__ = '0.10.14' From 94d7836321b34d9892f3deace05c7d369c07808f Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 6 Jun 2024 23:05:40 -0500 Subject: [PATCH 006/214] Ignore dist folder --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 906dc226..03545d1a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .coverage .tox/ +dist/ docs/_build/ htmlcov/ Tailbone.egg-info/ From 610e1666c01b48a5aae4990d51aa1cafc04d60ce Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 7 Jun 2024 10:07:31 -0500 Subject: [PATCH 007/214] Revert "Use `pkg_resources` to determine package versions" This reverts commit f6f2a53a0c7a542ead7bb5dc9a8414e6057ed774. --- tailbone/subscribers.py | 5 ----- tailbone/views/common.py | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index 59ef64dc..42d3cab7 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -28,7 +28,6 @@ import six import json import datetime import logging -import pkg_resources import warnings from collections import OrderedDict @@ -169,11 +168,7 @@ def before_render(event): renderer_globals = event renderer_globals['rattail_app'] = request.rattail_config.get_app() - renderer_globals['app_title'] = request.rattail_config.app_title() - pkg = rattail_config.app_package() - renderer_globals['app_version'] = pkg_resources.get_distribution(pkg).version - renderer_globals['h'] = helpers renderer_globals['url'] = request.route_url renderer_globals['rattail'] = rattail diff --git a/tailbone/views/common.py b/tailbone/views/common.py index 58346f3b..266561fd 100644 --- a/tailbone/views/common.py +++ b/tailbone/views/common.py @@ -24,8 +24,8 @@ Various common views """ +import importlib import os -import pkg_resources from collections import OrderedDict from rattail.batch import consume_batch_id @@ -108,7 +108,8 @@ class CommonView(View): return self.project_version pkg = self.rattail_config.app_package() - return pkg_resources.get_distribution(pkg).version + mod = importlib.import_module(pkg) + return mod.__version__ def exception(self): """ From a849d8452b6f9ece02a3df231b2e520caa5fc9f8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 7 Jun 2024 10:25:14 -0500 Subject: [PATCH 008/214] Update changelog --- CHANGES.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 178135e4..2295867e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,12 @@ CHANGELOG Unreleased ---------- +0.10.15 (unreleased) +-------------------- + +* Do *not* Use ``pkg_resources`` to determine package versions. + + 0.10.14 (2024-06-06) -------------------- From 7c3d5b46f38876c70d6114b23e678df5e810f6c6 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 7 Jun 2024 10:25:48 -0500 Subject: [PATCH 009/214] Update changelog --- CHANGES.rst | 2 +- tailbone/_version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 2295867e..a711be5f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,7 @@ CHANGELOG Unreleased ---------- -0.10.15 (unreleased) +0.10.15 (2024-06-07) -------------------- * Do *not* Use ``pkg_resources`` to determine package versions. diff --git a/tailbone/_version.py b/tailbone/_version.py index 7a64f8d0..f6e50fc4 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.10.14' +__version__ = '0.10.15' From b8ace1eb98b76b93025f84311201a4497076dc06 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 9 Jun 2024 23:07:52 -0500 Subject: [PATCH 010/214] fix: avoid deprecated config methods for app/node title --- tailbone/api/common.py | 11 ++++++----- tailbone/subscribers.py | 5 +++-- tailbone/templates/base_meta.mako | 2 +- tailbone/views/auth.py | 3 ++- tailbone/views/common.py | 11 +++++++---- tailbone/views/settings.py | 3 ++- tailbone/views/upgrades.py | 3 ++- 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/tailbone/api/common.py b/tailbone/api/common.py index 30dfeab1..1dcaff08 100644 --- a/tailbone/api/common.py +++ b/tailbone/api/common.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2023 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -27,8 +27,6 @@ Tailbone Web API - "Common" Views from collections import OrderedDict import rattail -from rattail.db import model -from rattail.mail import send_email from cornice import Service from cornice.service import get_services @@ -66,7 +64,8 @@ class CommonView(APIView): } def get_project_title(self): - return self.rattail_config.app_title(default="Tailbone") + app = self.get_rattail_app() + return app.get_title() def get_project_version(self): import tailbone @@ -87,6 +86,8 @@ class CommonView(APIView): """ View to handle user feedback form submits. """ + app = self.get_rattail_app() + model = self.model # TODO: this logic was copied from tailbone.views.common and is largely # identical; perhaps should merge somehow? schema = Feedback().bind(session=Session()) @@ -106,7 +107,7 @@ class CommonView(APIView): data['client_ip'] = self.request.client_addr email_key = data['email_key'] or self.feedback_email_key - send_email(self.rattail_config, email_key, data=data) + app.send_email(email_key, data=data) return {'ok': True} return {'error': "Form did not validate!"} diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index 42d3cab7..bc851629 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -165,10 +165,11 @@ def before_render(event): request = event.get('request') or threadlocal.get_current_request() rattail_config = request.rattail_config + app = rattail_config.get_app() renderer_globals = event - renderer_globals['rattail_app'] = request.rattail_config.get_app() - renderer_globals['app_title'] = request.rattail_config.app_title() + renderer_globals['rattail_app'] = app + renderer_globals['app_title'] = app.get_title() renderer_globals['h'] = helpers renderer_globals['url'] = request.route_url renderer_globals['rattail'] = rattail diff --git a/tailbone/templates/base_meta.mako b/tailbone/templates/base_meta.mako index 07b13e61..00cfdfe9 100644 --- a/tailbone/templates/base_meta.mako +++ b/tailbone/templates/base_meta.mako @@ -1,6 +1,6 @@ ## -*- coding: utf-8; -*- -<%def name="app_title()">${request.rattail_config.node_title(default="Rattail")} +<%def name="app_title()">${rattail_app.get_node_title()} <%def name="global_title()">${"[STAGE] " if not request.rattail_config.production() else ''}${self.app_title()} diff --git a/tailbone/views/auth.py b/tailbone/views/auth.py index 0f0d1687..7ecdc6cd 100644 --- a/tailbone/views/auth.py +++ b/tailbone/views/auth.py @@ -92,6 +92,7 @@ class AuthenticationView(View): """ The login view, responsible for displaying and handling the login form. """ + app = self.get_rattail_app() referrer = self.request.get_referrer(default=self.request.route_url('home')) # redirect if already logged in @@ -133,7 +134,7 @@ class AuthenticationView(View): 'form': form, 'referrer': referrer, 'image_url': image_url, - 'index_title': self.rattail_config.node_title(), + 'index_title': app.get_node_title(), 'help_url': global_help_url(self.rattail_config), } diff --git a/tailbone/views/common.py b/tailbone/views/common.py index 266561fd..25eb7dee 100644 --- a/tailbone/views/common.py +++ b/tailbone/views/common.py @@ -50,6 +50,7 @@ class CommonView(View): """ Home page view. """ + app = self.get_rattail_app() if not self.request.user: if self.rattail_config.getbool('tailbone', 'login_is_home', default=True): raise self.redirect(self.request.route_url('login')) @@ -60,7 +61,7 @@ class CommonView(View): context = { 'image_url': image_url, - 'index_title': self.rattail_config.node_title(), + 'index_title': app.get_node_title(), 'help_url': global_help_url(self.rattail_config), } @@ -99,7 +100,8 @@ class CommonView(View): return response def get_project_title(self): - return self.rattail_config.app_title() + app = self.get_rattail_app() + return app.get_title() def get_project_version(self): @@ -121,11 +123,12 @@ class CommonView(View): """ Generic view to show "about project" info page. """ + app = self.get_rattail_app() return { 'project_title': self.get_project_title(), 'project_version': self.get_project_version(), 'packages': self.get_packages(), - 'index_title': self.rattail_config.node_title(), + 'index_title': app.get_node_title(), } def get_packages(self): @@ -209,7 +212,7 @@ class CommonView(View): raise self.forbidden() app = self.get_rattail_app() - app_title = self.rattail_config.app_title() + app_title = app.get_title() poser_handler = app.get_poser_handler() poser_dir = poser_handler.get_default_poser_dir() poser_dir_exists = os.path.isdir(poser_dir) diff --git a/tailbone/views/settings.py b/tailbone/views/settings.py index cce5e53d..8d389530 100644 --- a/tailbone/views/settings.py +++ b/tailbone/views/settings.py @@ -67,8 +67,9 @@ class AppInfoView(MasterView): ] def get_index_title(self): + app = self.get_rattail_app() return "{} for {}".format(self.get_model_title_plural(), - self.rattail_config.app_title()) + app.get_title()) def get_data(self, session=None): pip = os.path.join(sys.prefix, 'bin', 'pip') diff --git a/tailbone/views/upgrades.py b/tailbone/views/upgrades.py index a281062e..3276b64d 100644 --- a/tailbone/views/upgrades.py +++ b/tailbone/views/upgrades.py @@ -147,10 +147,11 @@ class UpgradeView(MasterView): def template_kwargs_view(self, **kwargs): kwargs = super().template_kwargs_view(**kwargs) + app = self.get_rattail_app() model = self.model upgrade = kwargs['instance'] - kwargs['system_title'] = self.rattail_config.app_title() + kwargs['system_title'] = app.get_title() if upgrade.system: system = self.upgrade_handler.get_system(upgrade.system) if system: From 2c2727bf6632febc6ec823182498e803c9fd5617 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 09:07:10 -0500 Subject: [PATCH 011/214] feat: standardize how app, package versions are determined --- tailbone/api/common.py | 11 +++++------ tailbone/beaker.py | 8 ++++---- tailbone/subscribers.py | 1 + tailbone/views/common.py | 13 +++++-------- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/tailbone/api/common.py b/tailbone/api/common.py index 1dcaff08..6cacfb06 100644 --- a/tailbone/api/common.py +++ b/tailbone/api/common.py @@ -26,13 +26,12 @@ Tailbone Web API - "Common" Views from collections import OrderedDict -import rattail +from rattail.util import get_pkg_version from cornice import Service from cornice.service import get_services from cornice_swagger import CorniceSwagger -import tailbone from tailbone import forms from tailbone.forms.common import Feedback from tailbone.api import APIView, api @@ -68,8 +67,8 @@ class CommonView(APIView): return app.get_title() def get_project_version(self): - import tailbone - return tailbone.__version__ + app = self.get_rattail_app() + return app.get_version() def get_packages(self): """ @@ -77,8 +76,8 @@ class CommonView(APIView): 'about' page. """ return OrderedDict([ - ('rattail', rattail.__version__), - ('Tailbone', tailbone.__version__), + ('rattail', get_pkg_version('rattail')), + ('Tailbone', get_pkg_version('Tailbone')), ]) @api diff --git a/tailbone/beaker.py b/tailbone/beaker.py index b5d592f1..25a450df 100644 --- a/tailbone/beaker.py +++ b/tailbone/beaker.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2022 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -27,11 +27,11 @@ Note that most of the code for this module was copied from the beaker and pyramid_beaker projects. """ -from __future__ import unicode_literals, absolute_import - import time from pkg_resources import parse_version +from rattail.util import get_pkg_version + import beaker from beaker.session import Session from beaker.util import coerce_session_params @@ -49,7 +49,7 @@ class TailboneSession(Session): "Loads the data from this session from persistent storage" # are we using older version of beaker? - old_beaker = parse_version(beaker.__version__) < parse_version('1.12') + old_beaker = parse_version(get_pkg_version('beaker')) < parse_version('1.12') self.namespace = self.namespace_class(self.id, data_dir=self.data_dir, diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index bc851629..3fcd1017 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -170,6 +170,7 @@ def before_render(event): renderer_globals = event renderer_globals['rattail_app'] = app renderer_globals['app_title'] = app.get_title() + renderer_globals['app_version'] = app.get_version() renderer_globals['h'] = helpers renderer_globals['url'] = request.route_url renderer_globals['rattail'] = rattail diff --git a/tailbone/views/common.py b/tailbone/views/common.py index 25eb7dee..3c4b659b 100644 --- a/tailbone/views/common.py +++ b/tailbone/views/common.py @@ -24,12 +24,11 @@ Various common views """ -import importlib import os from collections import OrderedDict from rattail.batch import consume_batch_id -from rattail.util import simple_error +from rattail.util import get_pkg_version, simple_error from rattail.files import resource_path from tailbone import forms @@ -109,9 +108,8 @@ class CommonView(View): if hasattr(self, 'project_version'): return self.project_version - pkg = self.rattail_config.app_package() - mod = importlib.import_module(pkg) - return mod.__version__ + app = self.get_rattail_app() + return app.get_version() def exception(self): """ @@ -136,10 +134,9 @@ class CommonView(View): Should return the full set of packages which should be displayed on the 'about' page. """ - import rattail, tailbone return OrderedDict([ - ('rattail', rattail.__version__), - ('Tailbone', tailbone.__version__), + ('rattail', get_pkg_version('rattail')), + ('Tailbone', get_pkg_version('Tailbone')), ]) def change_theme(self): From dd58c640fa2a626efb4fc6a729cedf368ba3668f Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 11:11:06 -0500 Subject: [PATCH 012/214] Update changelog --- CHANGES.rst | 7 +++++++ tailbone/_version.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index a711be5f..ad65b7bf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,13 @@ CHANGELOG Unreleased ---------- +0.10.16 (2024-06-10) +-------------------- + +* fix: avoid deprecated config methods for app/node title +* feat: standardize how app, package versions are determined + + 0.10.15 (2024-06-07) -------------------- diff --git a/tailbone/_version.py b/tailbone/_version.py index f6e50fc4..e1187ee4 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8; -*- -__version__ = '0.10.15' +__version__ = '0.10.16' From 1402d437b5900aee406577696c5b02ae0281d5ba Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 16:23:38 -0500 Subject: [PATCH 013/214] feat: switch from setup.cfg to pyproject.toml + hatchling --- .gitignore | 2 + pyproject.toml | 101 +++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 101 ------------------------------------------- setup.py | 29 ------------- tailbone/_version.py | 8 +++- tasks.py | 13 +++++- 6 files changed, 122 insertions(+), 132 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 03545d1a..b3006f90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +*~ +*.pyc .coverage .tox/ dist/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..7c894886 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,101 @@ + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + + +[project] +name = "Tailbone" +version = "0.10.16" +description = "Backoffice Web Application for Rattail" +readme = "README.rst" +authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] +license = {text = "GNU GPL v3+"} +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Web Environment", + "Framework :: Pyramid", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Office/Business", + "Topic :: Software Development :: Libraries :: Python Modules", +] + +dependencies = [ + "asgiref", + "colander", + "ColanderAlchemy", + "cornice", + "cornice-swagger", + "deform", + "humanize", + "Mako", + "markdown", + "openpyxl", + "paginate", + "paginate_sqlalchemy", + "passlib", + "Pillow", + "pyramid>=2", + "pyramid_beaker", + "pyramid_deform", + "pyramid_exclog", + "pyramid_fanstatic", + "pyramid_mako", + "pyramid_retry", + "pyramid_tm", + "rattail[db,bouncer]", + "six", + "sa-filters", + "simplejson", + "transaction", + "waitress", + "WebHelpers2", + "zope.sqlalchemy", +] + + +[project.optional-dependencies] +docs = ["Sphinx", "sphinx-rtd-theme"] +tests = ["coverage", "mock", "pytest", "pytest-cov"] + + +[project.entry-points."paste.app_factory"] +main = "tailbone.app:main" +webapi = "tailbone.webapi:main" + + +[project.entry-points."rattail.cleaners"] +beaker = "tailbone.cleanup:BeakerCleaner" + + +[project.entry-points."rattail.config.extensions"] +tailbone = "tailbone.config:ConfigExtension" + + +[project.urls] +Homepage = "https://rattailproject.org" +Repository = "https://kallithea.rattailproject.org/rattail-project/tailbone" +Issues = "https://redmine.rattailproject.org/projects/tailbone/issues" +Changelog = "https://kallithea.rattailproject.org/rattail-project/tailbone/files/master/CHANGES.rst" + + +[tool.commitizen] +version_provider = "pep621" +tag_format = "v$version" +update_changelog_on_bump = true + + +# [tool.hatch.build.targets.wheel] +# packages = ["corepos"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 50c057f9..00000000 --- a/setup.cfg +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8; -*- - -[nosetests] -nocapture = 1 -cover-package = tailbone -cover-erase = 1 -cover-html = 1 -cover-html-dir = htmlcov - -[metadata] -name = Tailbone -version = attr: tailbone.__version__ -author = Lance Edgar -author_email = lance@edbob.org -url = http://rattailproject.org/ -license = GNU GPL v3 -description = Backoffice Web Application for Rattail -long_description = file: README.rst -classifiers = - Development Status :: 4 - Beta - Environment :: Web Environment - Framework :: Pyramid - Intended Audience :: Developers - License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Topic :: Internet :: WWW/HTTP - Topic :: Office/Business - Topic :: Software Development :: Libraries :: Python Modules - - -[options] -install_requires = - asgiref - colander - ColanderAlchemy - cornice - cornice-swagger - deform - humanize - Mako - markdown - openpyxl - paginate - paginate_sqlalchemy - passlib - Pillow - pyramid>=2 - pyramid_beaker - pyramid_deform - pyramid_exclog - pyramid_fanstatic - pyramid_mako - pyramid_retry - pyramid_tm - rattail[db,bouncer] - six - sa-filters - simplejson - transaction - waitress - WebHelpers2 - zope.sqlalchemy - -tests_require = Tailbone[tests] -test_suite = tests -packages = find: -include_package_data = True -zip_safe = False - - -[options.packages.find] -exclude = - tests.* - tests - - -[options.extras_require] -docs = Sphinx; sphinx-rtd-theme -tests = coverage; mock; pytest; pytest-cov - - -[options.entry_points] - -paste.app_factory = - main = tailbone.app:main - webapi = tailbone.webapi:main - -rattail.cleaners = - beaker = tailbone.cleanup:BeakerCleaner - -rattail.config.extensions = - tailbone = tailbone.config:ConfigExtension diff --git a/setup.py b/setup.py deleted file mode 100644 index 5645ddff..00000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8; -*- -################################################################################ -# -# Rattail -- Retail Software Framework -# Copyright © 2010-2023 Lance Edgar -# -# This file is part of Rattail. -# -# Rattail is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# Rattail. If not, see . -# -################################################################################ -""" -Setup script for Tailbone -""" - -from setuptools import setup - -setup() diff --git a/tailbone/_version.py b/tailbone/_version.py index e1187ee4..7095f6c8 100644 --- a/tailbone/_version.py +++ b/tailbone/_version.py @@ -1,3 +1,9 @@ # -*- coding: utf-8; -*- -__version__ = '0.10.16' +try: + from importlib.metadata import version +except ImportError: + from importlib_metadata import version + + +__version__ = version('Tailbone') diff --git a/tasks.py b/tasks.py index fba0b699..e9f47ccd 100644 --- a/tasks.py +++ b/tasks.py @@ -25,13 +25,24 @@ Tasks for Tailbone """ import os +import re import shutil from invoke import task here = os.path.abspath(os.path.dirname(__file__)) -exec(open(os.path.join(here, 'tailbone', '_version.py')).read()) +__version__ = None +pattern = re.compile(r'^version = "(\d+\.\d+\.\d+)"$') +with open(os.path.join(here, 'pyproject.toml'), 'rt') as f: + for line in f: + line = line.rstrip('\n') + match = pattern.match(line) + if match: + __version__ = match.group(1) + break +if not __version__: + raise RuntimeError("could not parse version!") @task From f9cb6cb59bdd525540bc46fc85ff1450bc52d11f Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 16:40:55 -0500 Subject: [PATCH 014/214] =?UTF-8?q?bump:=20version=200.10.16=20=E2=86=92?= =?UTF-8?q?=200.11.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 218 +++++++++++++++++++++++++++++ CHANGES.rst => docs/OLDCHANGES.rst | 199 +------------------------- docs/changelog.rst | 8 ++ docs/index.rst | 8 ++ pyproject.toml | 4 +- 5 files changed, 243 insertions(+), 194 deletions(-) create mode 100644 CHANGELOG.md rename CHANGES.rst => docs/OLDCHANGES.rst (97%) create mode 100644 docs/changelog.rst diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..c51f3fda --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,218 @@ + +# Changelog +All notable changes to Tailbone will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## v0.11.0 (2024-06-10) + +### Feat + +- switch from setup.cfg to pyproject.toml + hatchling + +## v0.10.16 (2024-06-10) + +### Feat + +- standardize how app, package versions are determined + +### Fix + +- avoid deprecated config methods for app/node title + +## v0.10.15 (2024-06-07) + +### Fix + +- do *not* Use `pkg_resources` to determine package versions + +## v0.10.14 (2024-06-06) + +### Fix + +- use `pkg_resources` to determine package versions + +## v0.10.13 (2024-06-06) + +### Feat + +- remove old/unused scaffold for use with `pcreate` + +- add 'fanstatic' support for sake of libcache assets + +## v0.10.12 (2024-06-04) + +### Feat + +- require pyramid 2.x; remove 1.x-style auth policies + +- remove version cap for deform + +- set explicit referrer when changing app theme + +- add `` component shim + +- include extra styles from `base_meta` template for butterball + +- include butterball theme by default for new apps + +### Fix + +- fix product lookup component, per butterball + +## v0.10.11 (2024-06-03) + +### Feat + +- fix vue3 refresh bugs for various views + +- fix grid bug for tempmon appliance view, per oruga + +- fix ordering worksheet generator, per butterball + +- fix inventory worksheet generator, per butterball + +## v0.10.10 (2024-06-03) + +### Feat + +- more butterball fixes for "view profile" template + +### Fix + +- fix focus for `` shim component + +## v0.10.9 (2024-06-03) + +### Feat + +- let master view control context menu items for page + +- fix the "new custorder" page for butterball + +### Fix + +- fix panel style for PO vs. Invoice breakdown in receiving batch + +## v0.10.8 (2024-06-02) + +### Feat + +- add styling for checked grid rows, per oruga/butterball + +- fix product view template for oruga/butterball + +- allow per-user custom styles for butterball + +- use oruga 0.8.9 by default + +## v0.10.7 (2024-06-01) + +### Feat + +- add setting to allow decimal quantities for receiving + +- log error if registry has no rattail config + +- add column filters for import/export main grid + +- escape all unsafe html for grid data + +- add speedbumps for delete, set preferred email/phone in profile view + +- fix file upload widget for oruga + +### Fix + +- fix overflow when instance header title is too long (butterball) + +## v0.10.6 (2024-05-29) + +### Feat + +- add way to flag organic products within lookup dialog + +- expose db picker for butterball theme + +- expose quickie lookup for butterball theme + +- fix basic problems with people profile view, per butterball + +## v0.10.5 (2024-05-29) + +### Feat + +- add `` component for oruga + +## v0.10.4 (2024-05-12) + +### Fix + +- fix styles for grid actions, per butterball + +## v0.10.3 (2024-05-10) + +### Fix + +- fix bug with grid date filters + +## v0.10.2 (2024-05-08) + +### Feat + +- remove version restriction for pyramid_beaker dependency + +- rename some attrs etc. for buefy components used with oruga + +- fix "tools" helper for receiving batch view, per oruga + +- more data type fixes for ```` + +- fix "view receiving row" page, per oruga + +- tweak styles for grid action links, per butterball + +### Fix + +- fix employees grid when viewing department (per oruga) + +- fix login "enter" key behavior, per oruga + +- fix button text for autocomplete + +## v0.10.1 (2024-04-28) + +### Feat + +- sort list of available themes + +- update various icon names for oruga compatibility + +- show "View This" button when cloning a record + +- stop including 'falafel' as available theme + +### Fix + +- fix vertical alignment in main menu bar, for butterball + +- fix upgrade execution logic/UI per oruga + +## v0.10.0 (2024-04-28) + +This version bump is to reflect adding support for Vue 3 + Oruga via +the 'butterball' theme. There is likely more work to be done for that +yet, but it mostly works at this point. + +### Feat + +- misc. template and view logic tweaks (applicable to all themes) for + better patterns, consistency etc. + +- add initial support for Vue 3 + Oruga, via "butterball" theme + + +## Older Releases + +Please see `docs/OLDCHANGES.rst` for older release notes. diff --git a/CHANGES.rst b/docs/OLDCHANGES.rst similarity index 97% rename from CHANGES.rst rename to docs/OLDCHANGES.rst index ad65b7bf..0a802f40 100644 --- a/CHANGES.rst +++ b/docs/OLDCHANGES.rst @@ -2,193 +2,8 @@ CHANGELOG ========= -Unreleased ----------- - -0.10.16 (2024-06-10) --------------------- - -* fix: avoid deprecated config methods for app/node title -* feat: standardize how app, package versions are determined - - -0.10.15 (2024-06-07) --------------------- - -* Do *not* Use ``pkg_resources`` to determine package versions. - - -0.10.14 (2024-06-06) --------------------- - -* Use ``pkg_resources`` to determine package versions. - - -0.10.13 (2024-06-06) --------------------- - -* Remove old/unused scaffold for use with ``pcreate``. - -* Add 'fanstatic' support for sake of libcache assets. - - -0.10.12 (2024-06-04) --------------------- - -* Require pyramid 2.x; remove 1.x-style auth policies. - -* Remove version cap for deform. - -* Set explicit referrer when changing app theme. - -* Add ```` component shim. - -* Include extra styles from ``base_meta`` template for butterball. - -* Fix product lookup component, per butterball. - -* Include butterball theme by default for new apps. - - -0.10.11 (2024-06-03) --------------------- - -* Fix vue3 refresh bugs for various views. - -* Fix grid bug for tempmon appliance view, per oruga. - -* Fix ordering worksheet generator, per butterball. - -* Fix inventory worksheet generator, per butterball. - - -0.10.10 (2024-06-03) --------------------- - -* Fix focus for ```` shim component. - -* More butterball fixes for "view profile" template. - - -0.10.9 (2024-06-03) -------------------- - -* Let master view control context menu items for page. - -* Fix panel style for PO vs. Invoice breakdown in receiving batch. - -* Fix the "new custorder" page for butterball. - - -0.10.8 (2024-06-02) -------------------- - -* Add styling for checked grid rows, per oruga/butterball. - -* Fix product view template for oruga/butterball. - -* Allow per-user custom styles for butterball. - -* Use oruga 0.8.9 by default. - - -0.10.7 (2024-06-01) -------------------- - -* Add setting to allow decimal quantities for receiving. - -* Log error if registry has no rattail config. - -* Add column filters for import/export main grid. - -* Fix overflow when instance header title is too long (butterball). - -* Escape all unsafe html for grid data. - -* Add speedbumps for delete, set preferred email/phone in profile view. - -* Fix file upload widget for oruga. - - -0.10.6 (2024-05-29) -------------------- - -* Add way to flag organic products within lookup dialog. - -* Expose db picker for butterball theme. - -* Expose quickie lookup for butterball theme. - -* Fix basic problems with people profile view, per butterball. - - -0.10.5 (2024-05-29) -------------------- - -* Add ```` component for oruga. - - -0.10.4 (2024-05-12) -------------------- - -* Fix styles for grid actions, per butterball. - - -0.10.3 (2024-05-10) -------------------- - -* Fix bug with grid date filters. - - -0.10.2 (2024-05-08) -------------------- - -* Fix employees grid when viewing department (per oruga). - -* Remove version restriction for pyramid_beaker dependency. - -* Fix login "enter" key behavior, per oruga. - -* Rename some attrs etc. for buefy components used with oruga. - -* Fix "tools" helper for receiving batch view, per oruga. - -* Fix button text for autocomplete. - -* More data type fixes for ````. - -* Fix "view receiving row" page, per oruga. - -* Tweak styles for grid action links, per butterball. - - -0.10.1 (2024-04-28) -------------------- - -* Sort list of available themes. - -* Update various icon names for oruga compatibility. - -* Fix vertical alignment in main menu bar, for butterball. - -* Fix upgrade execution logic/UI per oruga. - -* Show "View This" button when cloning a record. - -* Stop including 'falafel' as available theme. - - -0.10.0 (2024-04-28) -------------------- - -This version bump is to reflect adding support for Vue 3 + Oruga via -the 'butterball' theme. There is likely more work to be done for that -yet, but it mostly works at this point. - -* Misc. template and view logic tweaks (applicable to all themes) for - better patterns, consistency etc. - -* Add initial support for Vue 3 + Oruga, via "butterball" theme. +NB. this file contains "old" release notes only. for newer releases +see the `CHANGELOG.md` file in the source root folder. 0.9.96 (2024-04-25) @@ -5177,7 +4992,7 @@ and related technologies. 0.6.47 (2017-11-08) ------------------- -* Fix manifest to include *.pt deform templates +* Fix manifest to include ``*.pt`` deform templates 0.6.46 (2017-11-08) @@ -5510,13 +5325,13 @@ and related technologies. 0.6.13 (2017-07-26) ------------------- +------------------- * Allow master view to decide whether each grid checkbox is checked 0.6.12 (2017-07-26) ------------------- +------------------- * Add basic support for product inventory and status @@ -5524,7 +5339,7 @@ and related technologies. 0.6.11 (2017-07-18) ------------------- +------------------- * Tweak some basic styles for forms/grids @@ -5532,7 +5347,7 @@ and related technologies. 0.6.10 (2017-07-18) ------------------- +------------------- * Fix grid bug if "current page" becomes invalid diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 00000000..bbf94f4b --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1,8 @@ + +Changelog Archive +================= + +.. toctree:: + :maxdepth: 1 + + OLDCHANGES diff --git a/docs/index.rst b/docs/index.rst index 351e910d..db05d0c1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -60,6 +60,14 @@ Package API: api/views/purchasing.ordering +Changelog: + +.. toctree:: + :maxdepth: 1 + + changelog + + Documentation To-Do =================== diff --git a/pyproject.toml b/pyproject.toml index 7c894886..13a232ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "Tailbone" -version = "0.10.16" +version = "0.11.0" description = "Backoffice Web Application for Rattail" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] @@ -88,7 +88,7 @@ tailbone = "tailbone.config:ConfigExtension" Homepage = "https://rattailproject.org" Repository = "https://kallithea.rattailproject.org/rattail-project/tailbone" Issues = "https://redmine.rattailproject.org/projects/tailbone/issues" -Changelog = "https://kallithea.rattailproject.org/rattail-project/tailbone/files/master/CHANGES.rst" +Changelog = "https://kallithea.rattailproject.org/rattail-project/tailbone/files/master/CHANGELOG.md" [tool.commitizen] From fb0c538a2bd0d58f85ea37c4d8524b4fcf8515a0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 10 Jun 2024 17:42:29 -0500 Subject: [PATCH 015/214] test: skip running tests for py36 we should soon require python 3.8 anyway --- tox.ini | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index ea833b39..6e45883c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,9 @@ [tox] -envlist = py36, py37, py38, py39, py310, py311 +# TODO: i had to remove py36 since something (hatchling?) broke it +# somehow, and i was not able to quickly fix. as of writing only +# one app is known to run py36 and hopefully that is not for long. +envlist = py37, py38, py39, py310, py311 # TODO: can remove this when we drop py36 support # nb. need this for testing older python versions From 6e741f6156a50442426f6a59f2321d11eedcbdf3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 14 Jun 2024 17:57:01 -0500 Subject: [PATCH 016/214] fix: revert back to setup.py + setup.cfg apparently with python 3.6 things "mostly" work but then they break if any specified dependencies have a dot in the name. which in this project, is the case for `zope.sqlalchemy` so until we drop python 3.6 support, we cannot use pyproject.toml here --- pyproject.toml | 101 ------------------------------------------------- setup.cfg | 97 +++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 3 ++ 3 files changed, 100 insertions(+), 101 deletions(-) delete mode 100644 pyproject.toml create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 13a232ae..00000000 --- a/pyproject.toml +++ /dev/null @@ -1,101 +0,0 @@ - -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - - -[project] -name = "Tailbone" -version = "0.11.0" -description = "Backoffice Web Application for Rattail" -readme = "README.rst" -authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] -license = {text = "GNU GPL v3+"} -classifiers = [ - "Development Status :: 4 - Beta", - "Environment :: Web Environment", - "Framework :: Pyramid", - "Intended Audience :: Developers", - "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", - "Natural Language :: English", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Office/Business", - "Topic :: Software Development :: Libraries :: Python Modules", -] - -dependencies = [ - "asgiref", - "colander", - "ColanderAlchemy", - "cornice", - "cornice-swagger", - "deform", - "humanize", - "Mako", - "markdown", - "openpyxl", - "paginate", - "paginate_sqlalchemy", - "passlib", - "Pillow", - "pyramid>=2", - "pyramid_beaker", - "pyramid_deform", - "pyramid_exclog", - "pyramid_fanstatic", - "pyramid_mako", - "pyramid_retry", - "pyramid_tm", - "rattail[db,bouncer]", - "six", - "sa-filters", - "simplejson", - "transaction", - "waitress", - "WebHelpers2", - "zope.sqlalchemy", -] - - -[project.optional-dependencies] -docs = ["Sphinx", "sphinx-rtd-theme"] -tests = ["coverage", "mock", "pytest", "pytest-cov"] - - -[project.entry-points."paste.app_factory"] -main = "tailbone.app:main" -webapi = "tailbone.webapi:main" - - -[project.entry-points."rattail.cleaners"] -beaker = "tailbone.cleanup:BeakerCleaner" - - -[project.entry-points."rattail.config.extensions"] -tailbone = "tailbone.config:ConfigExtension" - - -[project.urls] -Homepage = "https://rattailproject.org" -Repository = "https://kallithea.rattailproject.org/rattail-project/tailbone" -Issues = "https://redmine.rattailproject.org/projects/tailbone/issues" -Changelog = "https://kallithea.rattailproject.org/rattail-project/tailbone/files/master/CHANGELOG.md" - - -[tool.commitizen] -version_provider = "pep621" -tag_format = "v$version" -update_changelog_on_bump = true - - -# [tool.hatch.build.targets.wheel] -# packages = ["corepos"] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..83ce9814 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,97 @@ + +[metadata] +name = Tailbone +version = 0.11.0 +author = Lance Edgar +author_email = lance@edbob.org +url = http://rattailproject.org/ +license = GNU GPL v3 +description = Backoffice Web Application for Rattail +long_description = file: README.rst +classifiers = + Development Status :: 4 - Beta + Environment :: Web Environment + Framework :: Pyramid + Intended Audience :: Developers + License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) + Natural Language :: English + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Topic :: Internet :: WWW/HTTP + Topic :: Office/Business + Topic :: Software Development :: Libraries :: Python Modules + + +[options] +packages = find: +include_package_data = True +install_requires = + asgiref + colander + ColanderAlchemy + cornice + cornice-swagger + deform + humanize + Mako + markdown + openpyxl + paginate + paginate_sqlalchemy + passlib + Pillow + pyramid>=2 + pyramid_beaker + pyramid_deform + pyramid_exclog + pyramid_fanstatic + pyramid_mako + pyramid_retry + pyramid_tm + rattail[db,bouncer] + six + sa-filters + simplejson + transaction + waitress + WebHelpers2 + zope.sqlalchemy + + +[options.packages.find] +exclude = + tests.* + tests + + +[options.extras_require] +docs = Sphinx; sphinx-rtd-theme +tests = coverage; mock; pytest; pytest-cov + + +[options.entry_points] + +paste.app_factory = + main = tailbone.app:main + webapi = tailbone.webapi:main + +rattail.cleaners = + beaker = tailbone.cleanup:BeakerCleaner + +rattail.config.extensions = + tailbone = tailbone.config:ConfigExtension + + +[nosetests] +nocapture = 1 +cover-package = tailbone +cover-erase = 1 +cover-html = 1 +cover-html-dir = htmlcov diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..b908cbe5 --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +import setuptools + +setuptools.setup() From ab4dbbedf05ffaf927d191fed670391f74a98eb1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 14 Jun 2024 18:01:40 -0500 Subject: [PATCH 017/214] =?UTF-8?q?bump:=20version=200.11.0=20=E2=86=92=20?= =?UTF-8?q?0.11.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ setup.cfg | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c51f3fda..40dfa16e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to Tailbone will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.11.1 (2024-06-14) + +### Fix + +- revert back to setup.py + setup.cfg + ## v0.11.0 (2024-06-10) ### Feat diff --git a/setup.cfg b/setup.cfg index 83ce9814..2ea746e9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = Tailbone -version = 0.11.0 +version = 0.11.1 author = Lance Edgar author_email = lance@edbob.org url = http://rattailproject.org/ From da4450b574cef8ec1b8cf77ac0c52085f395d5aa Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 14 Jun 2024 18:02:39 -0500 Subject: [PATCH 018/214] build: avoid version parse when uploading release --- tasks.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/tasks.py b/tasks.py index e9f47ccd..b57315a0 100644 --- a/tasks.py +++ b/tasks.py @@ -25,26 +25,11 @@ Tasks for Tailbone """ import os -import re import shutil from invoke import task -here = os.path.abspath(os.path.dirname(__file__)) -__version__ = None -pattern = re.compile(r'^version = "(\d+\.\d+\.\d+)"$') -with open(os.path.join(here, 'pyproject.toml'), 'rt') as f: - for line in f: - line = line.rstrip('\n') - match = pattern.match(line) - if match: - __version__ = match.group(1) - break -if not __version__: - raise RuntimeError("could not parse version!") - - @task def release(c, tests=False): """ @@ -53,7 +38,9 @@ def release(c, tests=False): if tests: c.run('tox') + if os.path.exists('dist'): + shutil.rmtree('dist') if os.path.exists('Tailbone.egg-info'): shutil.rmtree('Tailbone.egg-info') c.run('python -m build --sdist') - c.run(f'twine upload dist/tailbone-{__version__}.tar.gz') + c.run('twine upload dist/*') From 0212e52b6611b4906107217113f1fbe0e30d252d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 14 Jun 2024 19:59:52 -0500 Subject: [PATCH 019/214] fix: hide certain custorder settings if not applicable --- tailbone/templates/custorders/configure.mako | 51 ++++++++++++-------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/tailbone/templates/custorders/configure.mako b/tailbone/templates/custorders/configure.mako index d2f6610d..16d26d21 100644 --- a/tailbone/templates/custorders/configure.mako +++ b/tailbone/templates/custorders/configure.mako @@ -24,29 +24,38 @@ - - - Allow user to enter new contact info - - +
-

- If you allow users to enter new contact info, the default action - when the order is submitted, is to send email with details of - the new contact info.  Settings for these are at: -

+ + + Allow user to enter new contact info + + -
    -
  • - ${h.link_to("New Phone Request", url('emailprofiles.view', key='new_phone_requested'))} -
  • -
  • - ${h.link_to("New Email Request", url('emailprofiles.view', key='new_email_requested'))} -
  • -
+
+ +

+ If you allow users to enter new contact info, the default action + when the order is submitted, is to send email with details of + the new contact info.  Settings for these are at: +

+ +
    +
  • + ${h.link_to("New Phone Request", url('emailprofiles.view', key='new_phone_requested'))} +
  • +
  • + ${h.link_to("New Email Request", url('emailprofiles.view', key='new_email_requested'))} +
  • +
+ +
+

Product Handling

From 88e7d86087c590d3ae3bc957dc1685ca7b815414 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 18 Jun 2024 15:04:05 -0500 Subject: [PATCH 020/214] fix: use different logic for buefy/oruga for product lookup keydown i could have swore the new logic worked with buefy..but today it didn't --- tailbone/templates/products/lookup.mako | 28 +++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/tailbone/templates/products/lookup.mako b/tailbone/templates/products/lookup.mako index 7997eb7d..bb9590b2 100644 --- a/tailbone/templates/products/lookup.mako +++ b/tailbone/templates/products/lookup.mako @@ -56,7 +56,11 @@ + ref="searchTermInput" + % if not request.use_oruga: + @keydown.native="searchTermInputKeydown" + % endif + /> Date: Tue, 18 Jun 2024 16:06:55 -0500 Subject: [PATCH 021/214] fix: product records should be touchable --- tailbone/views/products.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 28186ac3..5265edbc 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -81,6 +81,7 @@ class ProductView(MasterView): supports_autocomplete = True bulk_deletable = True mergeable = True + touchable = True configurable = True labels = { From a0cd8835e038f4952824da17f37172d5fe9fe334 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 18 Jun 2024 16:07:07 -0500 Subject: [PATCH 022/214] fix: show flash error message if resolve pending product fails --- tailbone/views/products.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 5265edbc..c395ff24 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -2563,7 +2563,14 @@ class PendingProductView(MasterView): app = self.get_rattail_app() products_handler = app.get_products_handler() kwargs = self.get_resolve_product_kwargs() - products_handler.resolve_product(pending, product, self.request.user, **kwargs) + + try: + products_handler.resolve_product(pending, product, self.request.user, **kwargs) + except Exception as error: + log.warning("failed to resolve product", exc_info=True) + self.request.session.flash(f"Resolve failed: {simple_error(error)}", 'error') + return redirect + return redirect def get_resolve_product_kwargs(self, **kwargs): From 525a28f3fe7b0e1b6e21576f06bd0cc341252ff7 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 18 Jun 2024 18:05:05 -0500 Subject: [PATCH 023/214] =?UTF-8?q?bump:=20version=200.11.1=20=E2=86=92=20?= =?UTF-8?q?0.11.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 12 ++++++++++++ setup.cfg | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40dfa16e..ed866741 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to Tailbone will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.11.2 (2024-06-18) + +### Fix + +- hide certain custorder settings if not applicable + +- use different logic for buefy/oruga for product lookup keydown + +- product records should be touchable + +- show flash error message if resolve pending product fails + ## v0.11.1 (2024-06-14) ### Fix diff --git a/setup.cfg b/setup.cfg index 2ea746e9..aa14088a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = Tailbone -version = 0.11.1 +version = 0.11.2 author = Lance Edgar author_email = lance@edbob.org url = http://rattailproject.org/ From 067ca5bd4354f8dd47f5a3e9206627e3c6f6ae32 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 27 Jun 2024 23:11:13 -0500 Subject: [PATCH 024/214] fix: add link to "resolved by" user for pending products --- tailbone/views/products.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tailbone/views/products.py b/tailbone/views/products.py index c395ff24..bf2d7f14 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -2457,9 +2457,10 @@ class PendingProductView(MasterView): # resolved* if self.creating: f.remove('resolved', 'resolved_by') + elif pending.resolved: + f.set_renderer('resolved_by', self.render_user) else: - if not pending.resolved: - f.remove('resolved', 'resolved_by') + f.remove('resolved', 'resolved_by') def render_status_code(self, pending, field): status = pending.status_code From 3b7cc19faa758e83cb6f358e4bcb93fc3f15c06e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 28 Jun 2024 15:36:08 -0500 Subject: [PATCH 025/214] fix: handle error when merging 2 records fails should give the user some idea of the problem instead of just sending error email to admins --- tailbone/views/master.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tailbone/views/master.py b/tailbone/views/master.py index 48bc32fe..1e917902 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -2292,9 +2292,13 @@ class MasterView(View): except Exception as error: self.request.session.flash("Requested merge cannot proceed (maybe swap kept/removed and try again?): {}".format(error), 'error') else: - self.merge_objects(object_to_remove, object_to_keep) - self.request.session.flash("{} has been merged into {}".format(msg, object_to_keep)) - return self.redirect(self.get_action_url('view', object_to_keep)) + try: + self.merge_objects(object_to_remove, object_to_keep) + self.request.session.flash("{} has been merged into {}".format(msg, object_to_keep)) + return self.redirect(self.get_action_url('view', object_to_keep)) + except Exception as error: + error = simple_error(error) + self.request.session.flash(f"merge failed: {error}", 'error') if not object_to_remove or not object_to_keep or object_to_remove is object_to_keep: return self.redirect(self.get_index_url()) From d17bd35909444f30807b486a3b0eded5bb4915b4 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 28 Jun 2024 15:39:59 -0500 Subject: [PATCH 026/214] =?UTF-8?q?bump:=20version=200.11.2=20=E2=86=92=20?= =?UTF-8?q?0.11.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 ++++++++ setup.cfg | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed866741..f18a87ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to Tailbone will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.11.3 (2024-06-28) + +### Fix + +- add link to "resolved by" user for pending products + +- handle error when merging 2 records fails + ## v0.11.2 (2024-06-18) ### Fix diff --git a/setup.cfg b/setup.cfg index aa14088a..2dd65a74 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = Tailbone -version = 0.11.2 +version = 0.11.3 author = Lance Edgar author_email = lance@edbob.org url = http://rattailproject.org/ From ec5ed490d91438b679315ee88cfeb37c2368ac10 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 28 Jun 2024 17:34:54 -0500 Subject: [PATCH 027/214] fix: start/stop being root should submit POST instead of GET obviously it's access-restricted anyway but this just seems more correct but more importantly this makes the referrer explicit, since for some unknown reason i am suddenly seeing that be blank for certain installs where that wasn't the case before (?) - and the result was that every time you start/stop being root you would be redirected to home page instead of remaining on current page --- .../templates/themes/butterball/base.mako | 30 +++++++++++++++++-- tailbone/views/auth.py | 3 ++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/tailbone/templates/themes/butterball/base.mako b/tailbone/templates/themes/butterball/base.mako index 3f0253ce..339d23bd 100644 --- a/tailbone/templates/themes/butterball/base.mako +++ b/tailbone/templates/themes/butterball/base.mako @@ -924,9 +924,23 @@ % endif