From 7a9d5772db794d69632ce3a8621396d08e6ec679 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 26 Aug 2024 16:11:32 -0500 Subject: [PATCH 01/51] fix: handle differing email profile keys for appinfo/configure hopefully this all can improve some day soon.. --- tailbone/templates/configure.mako | 5 +- tailbone/views/settings.py | 96 +++++++++++++++++++++---------- 2 files changed, 69 insertions(+), 32 deletions(-) diff --git a/tailbone/templates/configure.mako b/tailbone/templates/configure.mako index 463d48b1..e6b128fc 100644 --- a/tailbone/templates/configure.mako +++ b/tailbone/templates/configure.mako @@ -280,15 +280,14 @@ Cancel - ${h.form(request.current_route_url())} + ${h.form(request.current_route_url(), **{'@submit': 'purgingSettings = true'})} ${h.csrf_token(request)} ${h.hidden('remove_settings', 'true')} + icon-left="trash"> {{ purgingSettings ? "Working, please wait..." : "Remove All Settings" }} ${h.end_form()} diff --git a/tailbone/views/settings.py b/tailbone/views/settings.py index 0180aa4b..10a0c2eb 100644 --- a/tailbone/views/settings.py +++ b/tailbone/views/settings.py @@ -77,13 +77,41 @@ class AppInfoView(WuttaAppInfoView): return context + # nb. these email settings require special handling below + configure_profile_key_mismatches = [ + 'default.subject', + 'default.to', + 'default.cc', + 'default.bcc', + 'feedback.subject', + 'feedback.to', + ] + def configure_get_simple_settings(self): """ """ simple_settings = super().configure_get_simple_settings() + # TODO: + # there are several email config keys which differ between + # wuttjamaican and rattail. basically all of the "profile" keys + # have a different prefix. + + # after wuttaweb has declared its settings, we examine each and + # overwrite the value if one is defined with rattail config key. + # (nb. this happens even if wuttjamaican key has a value!) + + # note that we *do* declare the profile mismatch keys for + # rattail, as part of simple settings. this ensures the + # parent logic will always remove them when saving. however + # we must also include them in gather_settings() to ensure + # they are saved to match wuttjamaican values. + + # there are also a couple of flags where rattail's default is the + # opposite of wuttjamaican. so we overwrite those too as needed. + for setting in simple_settings: - # TODO: the update home page redirect setting is off by + # nb. the update home page redirect setting is off by # default for wuttaweb, but on for tailbone if setting['name'] == 'wuttaweb.home_redirect_to_login': value = self.config.get_bool('wuttaweb.home_redirect_to_login') @@ -91,55 +119,43 @@ class AppInfoView(WuttaAppInfoView): value = self.config.get_bool('tailbone.login_is_home', default=True) setting['value'] = value - # TODO: sending email is off by default for wuttjamaican, + # nb. sending email is off by default for wuttjamaican, # but on for rattail elif setting['name'] == 'rattail.mail.send_emails': value = self.config.get_bool('rattail.mail.send_emails', default=True) setting['value'] = value - # TODO: email defaults have different config keys in rattail + # nb. this one is even more special, key is entirely different elif setting['name'] == 'rattail.email.default.sender': value = self.config.get('rattail.email.default.sender') if value is None: value = self.config.get('rattail.mail.default.from') setting['value'] = value - # TODO: email defaults have different config keys in rattail - elif setting['name'] == 'rattail.email.default.subject': - value = self.config.get('rattail.email.default.subject') - if value is None: - value = self.config.get('rattail.mail.default.subject') - setting['value'] = value + else: - # TODO: email defaults have different config keys in rattail - elif setting['name'] == 'rattail.email.default.to': - value = self.config.get('rattail.email.default.to') - if value is None: - value = self.config.get('rattail.mail.default.to') - setting['value'] = value - - # TODO: email defaults have different config keys in rattail - elif setting['name'] == 'rattail.email.default.cc': - value = self.config.get('rattail.email.default.cc') - if value is None: - value = self.config.get('rattail.mail.default.cc') - setting['value'] = value - - # TODO: email defaults have different config keys in rattail - elif setting['name'] == 'rattail.email.default.bcc': - value = self.config.get('rattail.email.default.bcc') - if value is None: - value = self.config.get('rattail.mail.default.bcc') - setting['value'] = value + # nb. fetch alternate value for profile key mismatch + for key in self.configure_profile_key_mismatches: + if setting['name'] == f'rattail.email.{key}': + value = self.config.get(f'rattail.email.{key}') + if value is None: + value = self.config.get(f'rattail.mail.{key}') + setting['value'] = value + break # nb. these are no longer used (deprecated), but we keep # them defined here so the tool auto-deletes them simple_settings.extend([ + {'name': 'tailbone.login_is_home'}, {'name': 'tailbone.buefy_version'}, {'name': 'tailbone.vue_version'}, ]) + simple_settings.append({'name': 'rattail.mail.default.from'}) + for key in self.configure_profile_key_mismatches: + simple_settings.append({'name': f'rattail.mail.{key}'}) + for key in self.get_weblibs(): simple_settings.extend([ {'name': f'tailbone.libver.{key}'}, @@ -148,6 +164,28 @@ class AppInfoView(WuttaAppInfoView): return simple_settings + def configure_gather_settings(self, data, simple_settings=None): + """ """ + settings = super().configure_gather_settings(data, simple_settings=simple_settings) + + # nb. must add legacy rattail profile settings to match new ones + for setting in list(settings): + + if setting['name'] == 'rattail.email.default.sender': + value = setting['value'] + settings.append({'name': 'rattail.mail.default.from', + 'value': value}) + + else: + for key in self.configure_profile_key_mismatches: + if setting['name'] == f'rattail.email.{key}': + value = setting['value'] + settings.append({'name': f'rattail.mail.{key}', + 'value': value}) + break + + return settings + class SettingView(MasterView): """ From ca05e688905398758470d5dd2db0ba288b8216a5 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 26 Aug 2024 16:12:14 -0500 Subject: [PATCH 02/51] =?UTF-8?q?bump:=20version=200.21.3=20=E2=86=92=200.?= =?UTF-8?q?21.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52a17a2f..e18c786c 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.21.4 (2024-08-26) + +### Fix + +- handle differing email profile keys for appinfo/configure + ## v0.21.3 (2024-08-26) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 2c18bd02..4845708b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "Tailbone" -version = "0.21.3" +version = "0.21.4" description = "Backoffice Web Application for Rattail" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 2e20fc5b7527275eaf7408dad56e3516ef6433e3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 27 Aug 2024 13:50:30 -0500 Subject: [PATCH 03/51] fix: set empty string for "-new-" file configure option otherwise the "-new-" option is not properly auto-selected --- tailbone/views/master.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tailbone/views/master.py b/tailbone/views/master.py index 1028ff27..6e05c35d 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -5441,7 +5441,7 @@ class MasterView(View): for template in self.normalize_input_file_templates( include_file_options=True): settings[template['setting_mode']] = template['mode'] - settings[template['setting_file']] = template['file'] + settings[template['setting_file']] = template['file'] or '' settings[template['setting_url']] = template['url'] file_options[template['key']] = template['file_options'] file_option_dirs[template['key']] = template['file_options_dir'] @@ -5457,7 +5457,7 @@ class MasterView(View): for template in self.normalize_output_file_templates( include_file_options=True): settings[template['setting_mode']] = template['mode'] - settings[template['setting_file']] = template['file'] + settings[template['setting_file']] = template['file'] or '' settings[template['setting_url']] = template['url'] file_options[template['key']] = template['file_options'] file_option_dirs[template['key']] = template['file_options_dir'] From b30f066c41f3b758882e0d8fc68e4a61b501e186 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 00:30:15 -0500 Subject: [PATCH 04/51] =?UTF-8?q?bump:=20version=200.21.4=20=E2=86=92=200.?= =?UTF-8?q?21.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e18c786c..d3c8a92f 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.21.5 (2024-08-28) + +### Fix + +- set empty string for "-new-" file configure option + ## v0.21.4 (2024-08-26) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 4845708b..4743fd3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "Tailbone" -version = "0.21.4" +version = "0.21.5" description = "Backoffice Web Application for Rattail" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] @@ -59,7 +59,7 @@ dependencies = [ "transaction", "waitress", "WebHelpers2", - "WuttaWeb>=0.13.1", + "WuttaWeb>=0.14.0", "zope.sqlalchemy>=1.5", ] From b81914fbf52357e3097a8f88d913c19ef30c0388 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 00:35:15 -0500 Subject: [PATCH 05/51] test: fix broken test --- tests/test_app.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index e16461ba..f49f6b13 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -5,12 +5,9 @@ from unittest import TestCase from pyramid.config import Configurator -from wuttjamaican.testing import FileConfigTestCase - from rattail.exceptions import ConfigurationError -from rattail.config import RattailConfig +from rattail.testing import DataTestCase from tailbone import app as mod -from tests.util import DataTestCase class TestRattailConfig(TestCase): @@ -30,7 +27,7 @@ class TestRattailConfig(TestCase): class TestMakePyramidConfig(DataTestCase): - def make_config(self): + def make_config(self, **kwargs): myconf = self.write_file('web.conf', """ [rattail.db] default.url = sqlite:// From 0b6cfaa9c57bbbf0ef3ad51cab4e5d5bc56d6843 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 09:53:14 -0500 Subject: [PATCH 06/51] fix: avoid error when grid value cannot be obtained --- tailbone/grids/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py index ecf462fd..c6257d4b 100644 --- a/tailbone/grids/core.py +++ b/tailbone/grids/core.py @@ -575,7 +575,11 @@ class Grid(WuttaGrid): return getattr(obj, column_name) except AttributeError: pass - return obj[column_name] + + try: + return obj[column_name] + except TypeError: + pass def render_currency(self, obj, column_name): value = self.obtain_value(obj, column_name) From 71d63f6b93fee7ff8ff2ff19eebe844dce9476df Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 09:53:37 -0500 Subject: [PATCH 07/51] =?UTF-8?q?bump:=20version=200.21.5=20=E2=86=92=200.?= =?UTF-8?q?21.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3c8a92f..59fcfcc9 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.21.6 (2024-08-28) + +### Fix + +- avoid error when grid value cannot be obtained + ## v0.21.5 (2024-08-28) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 4743fd3b..16018dbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "Tailbone" -version = "0.21.5" +version = "0.21.6" description = "Backoffice Web Application for Rattail" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From bc399182ba5eb957ae7c521f3b71701ff4bf39d1 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 14:20:17 -0500 Subject: [PATCH 08/51] fix: avoid error when form value cannot be obtained --- tailbone/forms/core.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tailbone/forms/core.py b/tailbone/forms/core.py index 059b212a..b5020975 100644 --- a/tailbone/forms/core.py +++ b/tailbone/forms/core.py @@ -1380,7 +1380,11 @@ class Form(object): return getattr(record, field_name) except AttributeError: pass - return record[field_name] + + try: + return record[field_name] + except TypeError: + pass # TODO: is this always safe to do? elif self.defaults and field_name in self.defaults: From 20dcdd8b86dfdbab1224676e3135ee8171b57f00 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 14:20:51 -0500 Subject: [PATCH 09/51] =?UTF-8?q?bump:=20version=200.21.6=20=E2=86=92=200.?= =?UTF-8?q?21.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59fcfcc9..aee19700 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.21.7 (2024-08-28) + +### Fix + +- avoid error when form value cannot be obtained + ## v0.21.6 (2024-08-28) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 16018dbb..45a2adc9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "Tailbone" -version = "0.21.6" +version = "0.21.7" description = "Backoffice Web Application for Rattail" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 812d8d2349e7517e2ef5702dcf904cd0b5c5c8af Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 14:37:18 -0500 Subject: [PATCH 10/51] fix: ignore session kwarg for `MasterView.make_row_grid()` --- tailbone/views/master.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tailbone/views/master.py b/tailbone/views/master.py index 6e05c35d..baf63caa 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -551,7 +551,8 @@ class MasterView(View): def get_quickie_result_url(self, obj): return self.get_action_url('view', obj) - def make_row_grid(self, factory=None, key=None, data=None, columns=None, **kwargs): + def make_row_grid(self, factory=None, key=None, data=None, columns=None, + session=None, **kwargs): """ Make and return a new (configured) rows grid instance. """ From 9be2f6347571d5989fabad88a9fc90ebf63812f9 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 14:37:40 -0500 Subject: [PATCH 11/51] =?UTF-8?q?bump:=20version=200.21.7=20=E2=86=92=200.?= =?UTF-8?q?21.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aee19700..a31b80ac 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.21.8 (2024-08-28) + +### Fix + +- ignore session kwarg for `MasterView.make_row_grid()` + ## v0.21.7 (2024-08-28) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 45a2adc9..350803dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "Tailbone" -version = "0.21.7" +version = "0.21.8" description = "Backoffice Web Application for Rattail" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 2219cf81988c583320014492a6e114c40e025e2b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 17:38:05 -0500 Subject: [PATCH 12/51] fix: render custom attrs in form component tag --- tailbone/forms/core.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tailbone/forms/core.py b/tailbone/forms/core.py index b5020975..601dcfb1 100644 --- a/tailbone/forms/core.py +++ b/tailbone/forms/core.py @@ -1037,9 +1037,9 @@ class Form(object): def render_vue_tag(self, **kwargs): """ """ - return self.render_vuejs_component() + return self.render_vuejs_component(**kwargs) - def render_vuejs_component(self): + def render_vuejs_component(self, **kwargs): """ Render the Vue.js component HTML for the form. @@ -1050,10 +1050,11 @@ class Form(object): """ - kwargs = dict(self.vuejs_component_kwargs) + kw = dict(self.vuejs_component_kwargs) + kw.update(kwargs) if self.can_edit_help: - kwargs.setdefault(':configure-fields-help', 'configureFieldsHelp') - return HTML.tag(self.vue_tagname, **kwargs) + kw.setdefault(':configure-fields-help', 'configureFieldsHelp') + return HTML.tag(self.vue_tagname, **kw) def set_json_data(self, key, value): """ From 55f45ae8a081123af3c8fc931a7745f0d7ea0b2b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 28 Aug 2024 17:38:33 -0500 Subject: [PATCH 13/51] =?UTF-8?q?bump:=20version=200.21.8=20=E2=86=92=200.?= =?UTF-8?q?21.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a31b80ac..da628cf3 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.21.9 (2024-08-28) + +### Fix + +- render custom attrs in form component tag + ## v0.21.8 (2024-08-28) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 350803dc..2720d003 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "Tailbone" -version = "0.21.8" +version = "0.21.9" description = "Backoffice Web Application for Rattail" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 8df52bf2a2d8902cc1565a5e46370273db580be2 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 29 Aug 2024 17:01:28 -0500 Subject: [PATCH 14/51] fix: expose datasync consumer batch size via configure page --- tailbone/templates/datasync/configure.mako | 29 ++++++---- tailbone/views/datasync.py | 65 +++++++++++++--------- 2 files changed, 55 insertions(+), 39 deletions(-) diff --git a/tailbone/templates/datasync/configure.mako b/tailbone/templates/datasync/configure.mako index 3651d0c4..2e444fb5 100644 --- a/tailbone/templates/datasync/configure.mako +++ b/tailbone/templates/datasync/configure.mako @@ -83,8 +83,8 @@ - Use these Settings to configure watchers and consumers @@ -99,7 +99,7 @@
+ v-show="simpleSettings['rattail.datasync.use_profile_settings']"> <${b}-table-column label="Actions" v-slot="props" - v-if="useProfileSettings"> + v-if="simpleSettings['rattail.datasync.use_profile_settings']"> @@ -580,18 +580,27 @@ - + + + + +

Legacy

- @@ -606,7 +615,6 @@ ThisPageData.showConfigFilesNote = false ThisPageData.profilesData = ${json.dumps(profiles_data)|n} ThisPageData.showDisabledProfiles = false - ThisPageData.useProfileSettings = ${json.dumps(use_profile_settings)|n} ThisPageData.editProfileShowDialog = false ThisPageData.editingProfile = null @@ -631,9 +639,6 @@ ThisPageData.editingConsumerRunas = null ThisPageData.editingConsumerEnabled = true - ThisPageData.supervisorProcessName = ${json.dumps(supervisor_process_name)|n} - ThisPageData.restartCommand = ${json.dumps(restart_command)|n} - ThisPage.computed.updateConsumerDisabled = function() { if (!this.editingConsumerKey) { return true diff --git a/tailbone/views/datasync.py b/tailbone/views/datasync.py index 134d6018..2b955b5f 100644 --- a/tailbone/views/datasync.py +++ b/tailbone/views/datasync.py @@ -202,10 +202,36 @@ class DataSyncThreadView(MasterView): return self.redirect(self.request.get_referrer( default=self.request.route_url('datasyncchanges'))) - def configure_get_context(self): + def configure_get_simple_settings(self): + """ """ + return [ + + # basic + {'section': 'rattail.datasync', + 'option': 'use_profile_settings', + 'type': bool}, + + # misc. + {'section': 'rattail.datasync', + 'option': 'supervisor_process_name'}, + {'section': 'rattail.datasync', + 'option': 'batch_size_limit', + 'type': int}, + + # legacy + {'section': 'tailbone', + 'option': 'datasync.restart'}, + + ] + + def configure_get_context(self, **kwargs): + """ """ + context = super().configure_get_context(**kwargs) + profiles = self.datasync_handler.get_configured_profiles( include_disabled=True, ignore_problems=True) + context['profiles'] = profiles profiles_data = [] for profile in sorted(profiles.values(), key=lambda p: p.key): @@ -243,25 +269,15 @@ class DataSyncThreadView(MasterView): data['consumers_data'] = consumers profiles_data.append(data) - return { - 'profiles': profiles, - 'profiles_data': profiles_data, - 'use_profile_settings': self.datasync_handler.should_use_profile_settings(), - 'supervisor_process_name': self.rattail_config.get( - 'rattail.datasync', 'supervisor_process_name'), - 'restart_command': self.rattail_config.get( - 'tailbone', 'datasync.restart'), - } + context['profiles_data'] = profiles_data + return context - def configure_gather_settings(self, data): - settings = [] - watch = [] + def configure_gather_settings(self, data, **kwargs): + """ """ + settings = super().configure_gather_settings(data, **kwargs) - use_profile_settings = data.get('use_profile_settings') == 'true' - settings.append({'name': 'rattail.datasync.use_profile_settings', - 'value': 'true' if use_profile_settings else 'false'}) - - if use_profile_settings: + if data.get('rattail.datasync.use_profile_settings') == 'true': + watch = [] for profile in json.loads(data['profiles']): pkey = profile['key'] @@ -323,17 +339,12 @@ class DataSyncThreadView(MasterView): settings.append({'name': 'rattail.datasync.watch', 'value': ', '.join(watch)}) - if data['supervisor_process_name']: - settings.append({'name': 'rattail.datasync.supervisor_process_name', - 'value': data['supervisor_process_name']}) - - if data['restart_command']: - settings.append({'name': 'tailbone.datasync.restart', - 'value': data['restart_command']}) - return settings - def configure_remove_settings(self): + def configure_remove_settings(self, **kwargs): + """ """ + super().configure_remove_settings(**kwargs) + purge_datasync_settings(self.rattail_config, self.Session()) @classmethod From b9b8bbd2eae1543cb74898f95e72cee5e7de6f46 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 29 Aug 2024 17:18:32 -0500 Subject: [PATCH 15/51] fix: wrap notes text for batch view --- tailbone/views/batch/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index 8ee3a37d..a75fda1c 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -383,7 +383,7 @@ class BatchMasterView(MasterView): f.set_label('executed_by', "Executed by") # notes - f.set_type('notes', 'text') + f.set_type('notes', 'text_wrapped') # if self.creating and self.request.user: # batch = fs.model From 5e742eab1795fe4c53573070af264c8d8a4cf3c0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 9 Sep 2024 08:32:28 -0500 Subject: [PATCH 16/51] fix: use better icon for submit button on login page --- tailbone/forms/core.py | 2 ++ tailbone/templates/forms/deform.mako | 2 +- tailbone/views/auth.py | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tailbone/forms/core.py b/tailbone/forms/core.py index 601dcfb1..4024557b 100644 --- a/tailbone/forms/core.py +++ b/tailbone/forms/core.py @@ -401,6 +401,8 @@ class Form(object): self.edit_help_url = edit_help_url self.route_prefix = route_prefix + self.button_icon_submit = kwargs.get('button_icon_submit', 'save') + def __iter__(self): return iter(self.fields) diff --git a/tailbone/templates/forms/deform.mako b/tailbone/templates/forms/deform.mako index ea35ab17..2100b460 100644 --- a/tailbone/templates/forms/deform.mako +++ b/tailbone/templates/forms/deform.mako @@ -59,7 +59,7 @@ native-type="submit" :disabled="${form.vue_component}Submitting" icon-pack="fas" - icon-left="save"> + icon-left="${form.button_icon_submit}"> {{ ${form.vue_component}Submitting ? "Working, please wait..." : "${form.button_label_submit}" }}
% else: diff --git a/tailbone/views/auth.py b/tailbone/views/auth.py index 730d7b6a..a54a19a9 100644 --- a/tailbone/views/auth.py +++ b/tailbone/views/auth.py @@ -24,8 +24,6 @@ Auth Views """ -from rattail.db.auth import set_user_password - import colander from deform import widget as dfwidget from pyramid.httpexceptions import HTTPForbidden @@ -104,6 +102,7 @@ class AuthenticationView(View): form.save_label = "Login" form.show_reset = True form.show_cancel = False + form.button_icon_submit = 'user' if form.validate(): user = self.authenticate_user(form.validated['username'], form.validated['password']) @@ -185,7 +184,8 @@ class AuthenticationView(View): schema = ChangePassword().bind(user=self.request.user, request=self.request) form = forms.Form(schema=schema, request=self.request) if form.validate(): - set_user_password(self.request.user, form.validated['new_password']) + auth = self.app.get_auth_handler() + auth.set_user_password(self.request.user, form.validated['new_password']) self.request.session.flash("Your password has been changed.") return self.redirect(self.request.get_referrer()) From a4d81a6e3cf431bae5fb91337ccf1c345e75c137 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 13 Sep 2024 18:16:07 -0500 Subject: [PATCH 17/51] docs: use markdown for readme file --- README.rst => README.md | 8 +++----- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) rename README.rst => README.md (56%) diff --git a/README.rst b/README.md similarity index 56% rename from README.rst rename to README.md index 0cffc62d..74c007f6 100644 --- a/README.rst +++ b/README.md @@ -1,10 +1,8 @@ -Tailbone -======== +# Tailbone Tailbone is an extensible web application based on Rattail. It provides a "back-office network environment" (BONE) for use in managing retail data. -Please see Rattail's `home page`_ for more information. - -.. _home page: http://rattailproject.org/ +Please see Rattail's [home page](http://rattailproject.org/) for more +information. diff --git a/pyproject.toml b/pyproject.toml index 2720d003..8c6525c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" name = "Tailbone" version = "0.21.9" description = "Backoffice Web Application for Rattail" -readme = "README.rst" +readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] license = {text = "GNU GPL v3+"} classifiers = [ From 0b646d2d187fafe743cb7816ab0a86d171b76646 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 14 Sep 2024 12:49:37 -0500 Subject: [PATCH 18/51] fix: update project repo links, kallithea -> forgejo --- pyproject.toml | 6 ++-- tailbone/views/upgrades.py | 69 +++++++++++--------------------------- 2 files changed, 23 insertions(+), 52 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8c6525c6..a1c96dd4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,9 +84,9 @@ 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" +Repository = "https://forgejo.wuttaproject.org/rattail/tailbone" +Issues = "https://forgejo.wuttaproject.org/rattail/tailbone/issues" +Changelog = "https://forgejo.wuttaproject.org/rattail/tailbone/src/branch/master/CHANGELOG.md" [tool.commitizen] diff --git a/tailbone/views/upgrades.py b/tailbone/views/upgrades.py index 3276b64d..ffa88032 100644 --- a/tailbone/views/upgrades.py +++ b/tailbone/views/upgrades.py @@ -348,56 +348,27 @@ class UpgradeView(MasterView): commit_hash_pattern = re.compile(r'^.{40}$') def get_changelog_projects(self): - projects = { - 'rattail': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/rattail/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-project/rattail/files/v{new_version}/CHANGES.rst', - }, - 'Tailbone': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone/files/v{new_version}/CHANGES.rst', - }, - 'pyCOREPOS': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/pycorepos/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-project/pycorepos/files/v{new_version}/CHANGES.rst', - }, - 'rattail_corepos': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-corepos/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-corepos/files/v{new_version}/CHANGES.rst', - }, - 'tailbone_corepos': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone-corepos/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone-corepos/files/v{new_version}/CHANGES.rst', - }, - 'onager': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-restricted/onager/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-restricted/onager/files/v{new_version}/CHANGES.rst', - }, - 'rattail-onager': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-restricted/rattail-onager/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-restricted/rattail-onager/files/v{new_version}/CHANGELOG.md', - }, - 'rattail_tempmon': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-tempmon/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-tempmon/files/v{new_version}/CHANGES.rst', - }, - 'tailbone-onager': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-restricted/tailbone-onager/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-restricted/tailbone-onager/files/v{new_version}/CHANGELOG.md', - }, - 'rattail_woocommerce': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-woocommerce/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-woocommerce/files/v{new_version}/CHANGES.rst', - }, - 'tailbone_woocommerce': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone-woocommerce/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone-woocommerce/files/v{new_version}/CHANGES.rst', - }, - 'tailbone_theo': { - 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/theo/changelog/{new_version}/?size=10', - 'release_url': 'https://kallithea.rattailproject.org/rattail-project/theo/files/v{new_version}/CHANGES.rst', - }, + project_map = { + 'onager': 'onager', + 'pyCOREPOS': 'pycorepos', + 'rattail': 'rattail', + 'rattail_corepos': 'rattail-corepos', + 'rattail-onager': 'rattail-onager', + 'rattail_tempmon': 'rattail-tempmon', + 'rattail_woocommerce': 'rattail-woocommerce', + 'Tailbone': 'tailbone', + 'tailbone_corepos': 'tailbone-corepos', + 'tailbone-onager': 'tailbone-onager', + 'tailbone_theo': 'theo', + 'tailbone_woocommerce': 'tailbone-woocommerce', } + + projects = {} + for name, repo in project_map.items(): + projects[name] = { + 'commit_url': f'https://forgejo.wuttaproject.org/rattail/{repo}/compare/{{old_version}}...{{new_version}}', + 'release_url': f'https://forgejo.wuttaproject.org/rattail/{repo}/src/tag/v{{new_version}}/CHANGELOG.md', + } return projects def get_changelog_url(self, project, old_version, new_version): From 0b4efae392ff35ca4a0d0ac1ea59859b25e084f2 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 15 Sep 2024 10:56:01 -0500 Subject: [PATCH 19/51] =?UTF-8?q?bump:=20version=200.21.9=20=E2=86=92=200.?= =?UTF-8?q?21.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da628cf3..73c8b72b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ 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.21.10 (2024-09-15) + +### Fix + +- update project repo links, kallithea -> forgejo +- use better icon for submit button on login page +- wrap notes text for batch view +- expose datasync consumer batch size via configure page + ## v0.21.9 (2024-08-28) ### Fix diff --git a/pyproject.toml b/pyproject.toml index a1c96dd4..3368842b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "Tailbone" -version = "0.21.9" +version = "0.21.10" description = "Backoffice Web Application for Rattail" readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 2308d2e2408ea5429ce196ed6c193241a21742a8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 16 Sep 2024 12:55:58 -0500 Subject: [PATCH 20/51] fix: become/stop root should redirect to previous url for default theme; butterball already did that --- tailbone/templates/base.mako | 18 ++++++++++++++++-- tailbone/templates/themes/butterball/base.mako | 16 ++-------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tailbone/templates/base.mako b/tailbone/templates/base.mako index 86b1ba1d..8228f823 100644 --- a/tailbone/templates/base.mako +++ b/tailbone/templates/base.mako @@ -632,9 +632,23 @@ % endif