From 7505cbe25a5dfd87ce6f1a3dbe5a0f7c77bf146f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Fri, 15 Nov 2024 20:46:20 +0100 Subject: [PATCH 1/4] feat: Add a `SITE_NAME` setting and use it everywhere. --- docs/configuration.md | 8 ++++++++ ihatemoney/default_settings.py | 1 + ihatemoney/templates/layout.html | 2 +- ihatemoney/tests/budget_test.py | 5 ++++- ihatemoney/tests/ihatemoney.cfg | 1 + ihatemoney/web.py | 5 +++++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index a6cc5d21..bf588471 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -173,6 +173,14 @@ URL you want. - **Default value:** `""` (empty string) - **Production value:** The URL of your chosing. +## SITE_NAME + +It is possible to change the name of the site to something at your liking. + +- **Default value:** `"I Hate Money"` (empty string) +- **Production value:** The name of your choosing + + ## Configuring email sending By default, Ihatemoney sends emails using a local SMTP server, but it's diff --git a/ihatemoney/default_settings.py b/ihatemoney/default_settings.py index 48112afb..64857378 100644 --- a/ihatemoney/default_settings.py +++ b/ihatemoney/default_settings.py @@ -3,6 +3,7 @@ DEBUG = SQLACHEMY_ECHO = False SQLALCHEMY_DATABASE_URI = "sqlite:////tmp/ihatemoney.db" SQLALCHEMY_TRACK_MODIFICATIONS = False SECRET_KEY = "tralala" +SITE_NAME = "I Hate Money" MAIL_DEFAULT_SENDER = "Budget manager " SHOW_ADMIN_EMAIL = True ACTIVATE_DEMO_PROJECT = True diff --git a/ihatemoney/templates/layout.html b/ihatemoney/templates/layout.html index 38b45064..5c04fb2e 100644 --- a/ihatemoney/templates/layout.html +++ b/ihatemoney/templates/layout.html @@ -20,7 +20,7 @@ - {{ _("Account manager") }}{% block title %}{% endblock %} + {{ SITE_NAME }} — {{ _("Account manager") }}{% block title %}{% endblock %} diff --git a/ihatemoney/tests/budget_test.py b/ihatemoney/tests/budget_test.py index 64a07533..a3fc813f 100644 --- a/ihatemoney/tests/budget_test.py +++ b/ihatemoney/tests/budget_test.py @@ -238,7 +238,10 @@ class TestBudget(IhatemoneyTestCase): url, data={"password": "pass", "password_confirmation": "pass"} ) resp = self.login("raclette", password="pass") - assert "Account manager - raclette" in resp.data.decode("utf-8") + assert ( + "I Hate Money — Account manager - raclette" + in resp.data.decode("utf-8") + ) # Test empty and null tokens resp = self.client.get("/reset-password") assert "No token provided" in resp.data.decode("utf-8") diff --git a/ihatemoney/tests/ihatemoney.cfg b/ihatemoney/tests/ihatemoney.cfg index 16c7534e..cba83608 100644 --- a/ihatemoney/tests/ihatemoney.cfg +++ b/ihatemoney/tests/ihatemoney.cfg @@ -3,6 +3,7 @@ DEBUG = False SQLALCHEMY_DATABASE_URI = 'sqlite:///budget.db' SQLACHEMY_ECHO = DEBUG +SITE_NAME = "I Hate Money" SECRET_KEY = "supersecret" diff --git a/ihatemoney/web.py b/ihatemoney/web.py index 9dfa17c6..43b04c21 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -137,6 +137,11 @@ def set_show_admin_dashboard_link(endpoint, values): g.logout_form = LogoutForm() +@main.context_processor +def add_template_variables(): + return {"SITE_NAME": current_app.config.get("SITE_NAME")} + + @main.url_value_preprocessor def pull_project(endpoint, values): """When a request contains a project_id value, transform it directly From 2aa410c68f37f6747aa9d6ceae6fccd5f3fc3e8f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 04:27:52 +0000 Subject: [PATCH 2/4] Update cachetools requirement from <5,>=4.1 to >=4.1,<6 Updates the requirements on [cachetools](https://github.com/tkem/cachetools) to permit the latest version. - [Changelog](https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst) - [Commits](https://github.com/tkem/cachetools/compare/v4.1.0...v5.5.0) --- updated-dependencies: - dependency-name: cachetools dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 57f18d0c..3c217184 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ dependencies = [ "blinker>=1.4,<2", - "cachetools>=4.1,<5", + "cachetools>=4.1,<6", "debts>=0.5,<1", "email_validator>=1.0,<3", "Flask>=2,<4", From 4e9ff9b1ac2f89c6b8f29ac8196ba1d74835fced Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 04:27:47 +0000 Subject: [PATCH 3/4] Update qrcode requirement from <8,>=7.1 to >=7.1,<9 Updates the requirements on [qrcode](https://github.com/lincolnloop/python-qrcode) to permit the latest version. - [Changelog](https://github.com/lincolnloop/python-qrcode/blob/main/CHANGES.rst) - [Commits](https://github.com/lincolnloop/python-qrcode/compare/v7.1...v8.0) --- updated-dependencies: - dependency-name: qrcode dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3c217184..6555c939 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ dependencies = [ "itsdangerous>=2,<3", "Jinja2>=3,<4", "python-dateutil", - "qrcode>=7.1,<8", + "qrcode>=7.1,<9", "requests>=2.25,<3", "SQLAlchemy>=1.3.0,<1.5", "SQLAlchemy-Continuum>=1.3.12,<2", # New 1.4 changes API, see #728 From 299c3849087c4ef073b8e3bb6b750ba2bcff0098 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 04:27:41 +0000 Subject: [PATCH 4/4] Bump ruff from 0.6.8 to 0.8.4 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.8 to 0.8.4. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.6.8...0.8.4) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6555c939..9d23cbc0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ database = [ "PyMySQL>=0.9,<1.2", ] dev = [ - "ruff==0.6.8", + "ruff==0.8.4", "flake8==5.0.4", "isort==5.11.5", "vermin==1.6.0",