From ab12cba1d5591f52748738176b63e1c86531b82b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Jul 2024 11:45:41 -0500 Subject: [PATCH 1/7] fix: remove legacy command definitions --- pyproject.toml | 4 ---- rattail_tutorial/commands.py | 32 -------------------------------- 2 files changed, 36 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 93c6a4b..a50184a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,10 +46,6 @@ main = "rattail_tutorial.web.app:main" rattail_tutorial = "rattail_tutorial.config:Rattail_tutorialConfig" -[project.entry-points."rattail_tutorial.subcommands"] -hello = "rattail_tutorial.commands:HelloWorld" - - [project.urls] Homepage = "https://rattailproject.org" repository = "https://kallithea.rattailproject.org/rattail-project/rattail-tutorial" diff --git a/rattail_tutorial/commands.py b/rattail_tutorial/commands.py index 6bca8f8..87c50f9 100644 --- a/rattail_tutorial/commands.py +++ b/rattail_tutorial/commands.py @@ -28,9 +28,7 @@ import sys import typer -from rattail import commands from rattail.commands.typer import make_typer -from rattail_tutorial import __version__ rattail_tutorial_typer = make_typer( @@ -47,33 +45,3 @@ def hello( The requisite 'hello world' example """ sys.stdout.write("hello world!\n") - - -def main(*args): - """ - Main entry point for Rattail Tutorial command system - """ - args = list(args or sys.argv[1:]) - cmd = Command() - cmd.run(*args) - - -class Command(commands.Command): - """ - Main command for Rattail Tutorial - """ - name = 'rattail_tutorial' - version = __version__ - description = "Rattail Tutorial (custom Rattail system)" - long_description = '' - - -class HelloWorld(commands.Subcommand): - """ - The requisite 'hello world' example - """ - name = 'hello' - description = __doc__.strip() - - def run(self, args): - self.stdout.write("hello world!\n") From f0dc65ee0833ba22a192415b5a059f5703fed866 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Jul 2024 11:46:10 -0500 Subject: [PATCH 2/7] =?UTF-8?q?bump:=20version=200.3.0=20=E2=86=92=200.3.1?= 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 d5a93c8..8b57c8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to rattail-tutorial will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project (probably doesn't) adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.3.1 (2024-07-01) + +### Fix + +- remove legacy command definitions + ## v0.3.0 (2024-07-01) ### Feat diff --git a/pyproject.toml b/pyproject.toml index a50184a..52aae87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "rattail-tutorial" -version = "0.3.0" +version = "0.3.1" description = "Rattail Development Tutorial" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 95f8ae318a00be95d6414bcb12ea7fe12f835edf Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 1 Jul 2024 13:25:31 -0500 Subject: [PATCH 3/7] fix: refactor custom menu builder, to inherit some menus also rename config extension, per conventions --- pyproject.toml | 2 +- rattail_tutorial/config.py | 8 +- rattail_tutorial/web/menus.py | 147 ++++++++++++++-------------------- 3 files changed, 65 insertions(+), 92 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 52aae87..9a33e70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ main = "rattail_tutorial.web.app:main" [project.entry-points."rattail.config.extensions"] -rattail_tutorial = "rattail_tutorial.config:Rattail_tutorialConfig" +rattail_tutorial = "rattail_tutorial.config:RattailTutorialConfig" [project.urls] diff --git a/rattail_tutorial/config.py b/rattail_tutorial/config.py index 1415ea1..eeb6944 100644 --- a/rattail_tutorial/config.py +++ b/rattail_tutorial/config.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -27,7 +27,7 @@ Custom config from rattail.config import ConfigExtension -class Rattail_tutorialConfig(ConfigExtension): +class RattailTutorialConfig(ConfigExtension): """ Rattail config extension for Rattail Tutorial """ @@ -36,5 +36,5 @@ class Rattail_tutorialConfig(ConfigExtension): def configure(self, config): # set some default config values - config.setdefault('rattail.mail', 'emails', 'rattail_tutorial.emails') - config.setdefault('tailbone', 'menus', 'rattail_tutorial.web.menus') + config.setdefault('rattail.mail.emails', 'rattail_tutorial.emails') + config.setdefault('tailbone.menus.handler', 'rattail_tutorial.web.menus:TutorialMenuHandler') diff --git a/rattail_tutorial/web/menus.py b/rattail_tutorial/web/menus.py index b9b6d40..402ca8a 100644 --- a/rattail_tutorial/web/menus.py +++ b/rattail_tutorial/web/menus.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -24,166 +24,139 @@ Web Menus """ +from tailbone import menus as base -def simple_menus(request): - url = request.route_url - menus = [ - { +class TutorialMenuHandler(base.MenuHandler): + """ + Demo menu handler + """ + + def make_menus(self, request, **kwargs): + + products_menu = self.make_products_menu(request) + + vendors_menu = self.make_vendors_menu(request) + + company_menu = self.make_company_menu(request) + + batches_menu = self.make_batches_menu(request) + + admin_menu = self.make_admin_menu(request, + include_stores=False, + include_tenders=False) + + menus = [ + products_menu, + vendors_menu, + company_menu, + batches_menu, + admin_menu, + ] + + return menus + + def make_products_menu(self, request, **kwargs): + return { 'title': "Products", 'type': 'menu', 'items': [ { 'title': "Products", - 'url': url('products'), + 'route': 'products', 'perm': 'products.list', }, { 'title': "Brands", - 'url': url('brands'), + 'route': 'brands', 'perm': 'brands.list', }, { 'title': "Report Codes", - 'url': url('reportcodes'), + 'route': 'reportcodes', 'perm': 'reportcodes.list', }, ], - }, - { + } + + def make_vendors_menu(self, request, **kwargs): + return { 'title': "Vendors", 'type': 'menu', 'items': [ { 'title': "Vendors", - 'url': url('vendors'), + 'route': 'vendors', 'perm': 'vendors.list', }, {'type': 'sep'}, { 'title': "Catalogs", - 'url': url('vendorcatalogs'), + 'route': 'vendorcatalogs', 'perm': 'vendorcatalogs.list', }, { 'title': "Upload New Catalog", - 'url': url('vendorcatalogs.create'), + 'route': 'vendorcatalogs.create', 'perm': 'vendorcatalogs.create', }, ], - }, - { + } + + def make_company_menu(self, request, **kwargs): + return { 'title': "Company", 'type': 'menu', 'items': [ { 'title': "Stores", - 'url': url('stores'), + 'route': 'stores', 'perm': 'stores.list', }, { 'title': "Departments", - 'url': url('departments'), + 'route': 'departments', 'perm': 'departments.list', }, { 'title': "Subdepartments", - 'url': url('subdepartments'), + 'route': 'subdepartments', 'perm': 'subdepartments.list', }, {'type': 'sep'}, { 'title': "Employees", - 'url': url('employees'), + 'route': 'employees', 'perm': 'employees.list', }, {'type': 'sep'}, { 'title': "Customers", - 'url': url('customers'), + 'route': 'customers', 'perm': 'customers.list', }, { 'title': "Customer Groups", - 'url': url('customergroups'), + 'route': 'customergroups', 'perm': 'customergroups.list', }, ], - }, - { + } + + def make_batches_menu(self, request, **kwargs): + return { 'title': "Batches", 'type': 'menu', 'items': [ { 'title': "Handheld", - 'url': url('batch.handheld'), + 'route': 'batch.handheld', 'perm': 'batch.handheld.list', }, { 'title': "Inventory", - 'url': url('batch.inventory'), + 'route': 'batch.inventory', 'perm': 'batch.inventory.list', }, ], - }, - { - 'title': "Admin", - 'type': 'menu', - 'items': [ - { - 'title': "Users", - 'url': url('users'), - 'perm': 'users.list', - }, - { - 'title': "User Events", - 'url': url('userevents'), - 'perm': 'userevents.list', - }, - { - 'title': "Roles", - 'url': url('roles'), - 'perm': 'roles.list', - }, - {'type': 'sep'}, - { - 'title': "App Settings", - 'url': url('appsettings'), - 'perm': 'settings.list', - }, - { - 'title': "Email Settings", - 'url': url('emailprofiles'), - 'perm': 'emailprofiles.list', - }, - { - 'title': "Email Attempts", - 'url': url('email_attempts'), - 'perm': 'email_attempts.list', - }, - { - 'title': "Raw Settings", - 'url': url('settings'), - 'perm': 'settings.list', - }, - {'type': 'sep'}, - { - 'title': "DataSync Changes", - 'url': url('datasyncchanges'), - 'perm': 'datasync.list', - }, - { - 'title': "Tables", - 'url': url('tables'), - 'perm': 'tables.list', - }, - { - 'title': "Rattail Tutorial Upgrades", - 'url': url('upgrades'), - 'perm': 'upgrades.list', - }, - ], - }, - ] - - return menus + } From 1fb3ee10d05410c98e5778e00ff836c3b2b2a38a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 9 Jul 2024 10:16:31 -0500 Subject: [PATCH 4/7] fix: update config for custom emails per upstream changes --- pyproject.toml | 4 ++++ rattail_tutorial/config.py | 1 - rattail_tutorial/emails.py | 5 +---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9a33e70..1beb55c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,10 @@ main = "rattail_tutorial.web.app:main" rattail_tutorial = "rattail_tutorial.config:RattailTutorialConfig" +[project.entry-points."rattail.emails"] +rattail_tutorial = "rattail_tutorial.emails" + + [project.urls] Homepage = "https://rattailproject.org" repository = "https://kallithea.rattailproject.org/rattail-project/rattail-tutorial" diff --git a/rattail_tutorial/config.py b/rattail_tutorial/config.py index eeb6944..12798ec 100644 --- a/rattail_tutorial/config.py +++ b/rattail_tutorial/config.py @@ -36,5 +36,4 @@ class RattailTutorialConfig(ConfigExtension): def configure(self, config): # set some default config values - config.setdefault('rattail.mail.emails', 'rattail_tutorial.emails') config.setdefault('tailbone.menus.handler', 'rattail_tutorial.web.menus:TutorialMenuHandler') diff --git a/rattail_tutorial/emails.py b/rattail_tutorial/emails.py index 1e82c6a..4359049 100644 --- a/rattail_tutorial/emails.py +++ b/rattail_tutorial/emails.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2019 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -26,9 +26,6 @@ Custom email profiles from rattail.mail import Email -# bring in some common ones from rattail -from rattail.emails import datasync_error_watcher_get_changes, filemon_action_error - class rattail_import_sample_updates(Email): """ From b96c828fa3461aaffb166aa0be2ff3898ac75970 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 16 Aug 2024 13:34:48 -0500 Subject: [PATCH 5/7] fix: avoid deprecated base class for config extension --- rattail_tutorial/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rattail_tutorial/config.py b/rattail_tutorial/config.py index 12798ec..5b54e1f 100644 --- a/rattail_tutorial/config.py +++ b/rattail_tutorial/config.py @@ -24,10 +24,10 @@ Custom config """ -from rattail.config import ConfigExtension +from wuttjamaican.conf import WuttaConfigExtension -class RattailTutorialConfig(ConfigExtension): +class RattailTutorialConfig(WuttaConfigExtension): """ Rattail config extension for Rattail Tutorial """ From 70b103ebd84fc5afb5ec93ebda14a72c41fdf1d0 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 13 Sep 2024 18:21:24 -0500 Subject: [PATCH 6/7] docs: use markdown for readme file --- README.rst => README.md | 8 ++------ pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) rename README.rst => README.md (59%) diff --git a/README.rst b/README.md similarity index 59% rename from README.rst rename to README.md index 1d15628..d8b38c1 100644 --- a/README.rst +++ b/README.md @@ -1,13 +1,9 @@ -.. -*- mode: rst -*- -rattail-tutorial -================ +# rattail-tutorial This project is intended for use as a "tutorial" for Rattail app development. It contains documentation for the tutorial itself, but also contains code for the tutorial app, which users may run locally for testing. -See the `Rattail website`_ for more info. - -.. _`Rattail website`: https://rattailproject.org/ +See the [Rattail website](https://rattailproject.org/) for more info. diff --git a/pyproject.toml b/pyproject.toml index 1beb55c..f70a108 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" name = "rattail-tutorial" version = "0.3.1" description = "Rattail Development Tutorial" -readme = "README.rst" +readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] license = {text = "GNU GPL v3+"} classifiers = [ From 06394dc3e3e7f2179e4ec5e76d63c2a8ce12e178 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 14 Sep 2024 10:47:30 -0500 Subject: [PATCH 7/7] docs: update project links, kallithea -> forgejo --- docs/create-project.rst | 2 +- pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/create-project.rst b/docs/create-project.rst index 4c6932a..9cb84ec 100644 --- a/docs/create-project.rst +++ b/docs/create-project.rst @@ -125,7 +125,7 @@ rattail-tutorial app instead, you should do this:: mkdir -p ~/src cd ~/src - git clone https://rattailproject.org/git/rattail-tutorial.git + git clone https://forgejo.wuttaproject.org/rattail/rattail-tutorial.git pip install -e rattail-tutorial Creating the Project diff --git a/pyproject.toml b/pyproject.toml index f70a108..f2c9f05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,8 +52,8 @@ rattail_tutorial = "rattail_tutorial.emails" [project.urls] Homepage = "https://rattailproject.org" -repository = "https://kallithea.rattailproject.org/rattail-project/rattail-tutorial" -Changelog = "https://kallithea.rattailproject.org/rattail-project/rattail-tutorial/files/master/CHANGELOG.md" +repository = "https://forgejo.wuttaproject.org/rattail/rattail-tutorial" +Changelog = "https://forgejo.wuttaproject.org/rattail/rattail-tutorial/src/branch/master/CHANGELOG.md" [tool.commitizen]