From 1d875947979f4addc57d16b2c496d8becfc638f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Such=C3=A1nek?= Date: Tue, 19 Mar 2024 09:39:20 +0100 Subject: [PATCH 1/2] fix(mailer): Fix color handling in mailer --- packages/dsw-mailer/CHANGELOG.md | 4 ++++ packages/dsw-mailer/dsw/mailer/model.py | 24 +++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/packages/dsw-mailer/CHANGELOG.md b/packages/dsw-mailer/CHANGELOG.md index 6813228f..47152c02 100644 --- a/packages/dsw-mailer/CHANGELOG.md +++ b/packages/dsw-mailer/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- Fixed color handling for custom colors in emails + ## [4.4.0] diff --git a/packages/dsw-mailer/dsw/mailer/model.py b/packages/dsw-mailer/dsw/mailer/model.py index 35a91055..bb6fd704 100644 --- a/packages/dsw-mailer/dsw/mailer/model.py +++ b/packages/dsw-mailer/dsw/mailer/model.py @@ -1,4 +1,5 @@ import os +import re from typing import Optional @@ -18,10 +19,23 @@ def contrast_ratio(color1: 'Color', color2: 'Color') -> float: else: return l2 / l1 - def __init__(self, color_hex: str = '#000000'): + def __init__(self, color_hex: str = '#000000', default: str = '#000000'): + color_hex = self.parse_color_to_hex(color_hex) or default h = color_hex.lstrip('#') self.red, self.green, self.blue = tuple(int(h[i:i+2], 16) for i in (0, 2, 4)) + @staticmethod + def parse_color_to_hex(color: str) -> Optional[str]: + color = color.strip() + if re.match(r'^#[0-9a-fA-F]{6}$', color): + return color + if re.match(r'^#[0-9a-fA-F]{3}$', color): + r = color[1] + g = color[2] + b = color[3] + return f'#{r}{r}{g}{g}{b}{b}' + return None + @property def hex(self): return f'#{self.red:02x}{self.green:02x}{self.blue:02x}' @@ -67,8 +81,8 @@ class StyleConfig: def __init__(self, logo_url: Optional[str], primary_color: str, illustrations_color: str): self.logo_url = logo_url - self.primary_color = Color(primary_color) - self.illustrations_color = Color(illustrations_color) + self.primary_color = Color(primary_color, Color.DEFAULT_PRIMARY_HEX) + self.illustrations_color = Color(illustrations_color, Color.DEFAULT_ILLUSTRATIONS_HEX) def from_dict(self, data: Optional[dict]): data = data or dict() @@ -78,12 +92,12 @@ def from_dict(self, data: Optional[dict]): self.primary_color = Color(data.get( 'primaryColor', self.default().primary_color.hex - )) + ), Color.DEFAULT_PRIMARY_HEX) if data.get('illustrationsColor', None) is not None: self.illustrations_color = Color(data.get( 'illustrationsColor', self.default().illustrations_color.hex, - )) + ), Color.DEFAULT_ILLUSTRATIONS_HEX) @classmethod def default(cls): From 82e44a142c4a56a16995eeff39beb59db368e7eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Such=C3=A1nek?= Date: Tue, 19 Mar 2024 09:41:24 +0100 Subject: [PATCH 2/2] Hotfix 4.4.1 --- packages/dsw-command-queue/CHANGELOG.md | 5 +++++ packages/dsw-command-queue/pyproject.toml | 4 ++-- packages/dsw-config/CHANGELOG.md | 5 +++++ packages/dsw-config/pyproject.toml | 2 +- packages/dsw-data-seeder/CHANGELOG.md | 5 +++++ packages/dsw-data-seeder/dsw/data_seeder/consts.py | 2 +- packages/dsw-data-seeder/pyproject.toml | 10 +++++----- packages/dsw-database/CHANGELOG.md | 5 +++++ packages/dsw-database/pyproject.toml | 4 ++-- packages/dsw-document-worker/CHANGELOG.md | 5 +++++ .../dsw-document-worker/dsw/document_worker/consts.py | 2 +- packages/dsw-document-worker/pyproject.toml | 10 +++++----- packages/dsw-mailer/CHANGELOG.md | 5 ++++- packages/dsw-mailer/dsw/mailer/consts.py | 2 +- packages/dsw-mailer/pyproject.toml | 8 ++++---- packages/dsw-models/CHANGELOG.md | 5 +++++ packages/dsw-models/pyproject.toml | 2 +- packages/dsw-storage/CHANGELOG.md | 5 +++++ packages/dsw-storage/pyproject.toml | 4 ++-- packages/dsw-tdk/CHANGELOG.md | 5 +++++ packages/dsw-tdk/dsw/tdk/consts.py | 2 +- packages/dsw-tdk/pyproject.toml | 2 +- 22 files changed, 71 insertions(+), 28 deletions(-) diff --git a/packages/dsw-command-queue/CHANGELOG.md b/packages/dsw-command-queue/CHANGELOG.md index d01a4a9d..57dcd50b 100644 --- a/packages/dsw-command-queue/CHANGELOG.md +++ b/packages/dsw-command-queue/CHANGELOG.md @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [4.4.1] + +Released for version consistency with other DSW tools. + ## [4.4.0] Released for version consistency with other DSW tools. @@ -189,3 +193,4 @@ Released for version consistency with other DSW tools. [4.3.0]: /../../tree/v4.3.0 [4.3.1]: /../../tree/v4.3.1 [4.4.0]: /../../tree/v4.4.0 +[4.4.1]: /../../tree/v4.4.1 diff --git a/packages/dsw-command-queue/pyproject.toml b/packages/dsw-command-queue/pyproject.toml index 3534e4b6..f918bb86 100644 --- a/packages/dsw-command-queue/pyproject.toml +++ b/packages/dsw-command-queue/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'dsw-command-queue' -version = "4.4.0" +version = "4.4.1" description = 'Library for working with command queue and persistent commands' readme = 'README.md' keywords = ['dsw', 'subscriber', 'publisher', 'database', 'queue', 'processing'] @@ -25,7 +25,7 @@ classifiers = [ requires-python = '>=3.10, <4' dependencies = [ # DSW - "dsw-database==4.4.0", + "dsw-database==4.4.1", ] [project.urls] diff --git a/packages/dsw-config/CHANGELOG.md b/packages/dsw-config/CHANGELOG.md index ba28269b..771f93c1 100644 --- a/packages/dsw-config/CHANGELOG.md +++ b/packages/dsw-config/CHANGELOG.md @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [4.4.1] + +Released for version consistency with other DSW tools. + ## [4.4.0] Released for version consistency with other DSW tools. @@ -197,3 +201,4 @@ Released for version consistency with other DSW tools. [4.3.0]: /../../tree/v4.3.0 [4.3.1]: /../../tree/v4.3.1 [4.4.0]: /../../tree/v4.4.0 +[4.4.1]: /../../tree/v4.4.1 diff --git a/packages/dsw-config/pyproject.toml b/packages/dsw-config/pyproject.toml index 2436a9f3..ee06f4df 100644 --- a/packages/dsw-config/pyproject.toml +++ b/packages/dsw-config/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'dsw-config' -version = "4.4.0" +version = "4.4.1" description = 'Library for DSW config manipulation' readme = 'README.md' keywords = ['dsw', 'config', 'yaml', 'parser'] diff --git a/packages/dsw-data-seeder/CHANGELOG.md b/packages/dsw-data-seeder/CHANGELOG.md index 8eff86fa..7bbb3f36 100644 --- a/packages/dsw-data-seeder/CHANGELOG.md +++ b/packages/dsw-data-seeder/CHANGELOG.md @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [4.4.1] + +Released for version consistency with other DSW tools. + ## [4.4.0] Released for version consistency with other DSW tools. @@ -247,3 +251,4 @@ Released for version consistency with other DSW tools. [4.3.0]: /../../tree/v4.3.0 [4.3.1]: /../../tree/v4.3.1 [4.4.0]: /../../tree/v4.4.0 +[4.4.1]: /../../tree/v4.4.1 diff --git a/packages/dsw-data-seeder/dsw/data_seeder/consts.py b/packages/dsw-data-seeder/dsw/data_seeder/consts.py index 4f8a1cd8..7ea2b038 100644 --- a/packages/dsw-data-seeder/dsw/data_seeder/consts.py +++ b/packages/dsw-data-seeder/dsw/data_seeder/consts.py @@ -6,7 +6,7 @@ DEFAULT_PLACEHOLDER = '<<|TENANT-ID|>>' NULL_UUID = '00000000-0000-0000-0000-000000000000' PROG_NAME = 'dsw-data-seeder' -VERSION = '4.4.0' +VERSION = '4.4.1' VAR_APP_CONFIG_PATH = 'APPLICATION_CONFIG_PATH' VAR_WORKDIR_PATH = 'WORKDIR_PATH' diff --git a/packages/dsw-data-seeder/pyproject.toml b/packages/dsw-data-seeder/pyproject.toml index eebfb7bb..97b46943 100644 --- a/packages/dsw-data-seeder/pyproject.toml +++ b/packages/dsw-data-seeder/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'dsw-data-seeder' -version = "4.4.0" +version = "4.4.1" description = 'Worker for seeding DSW data' readme = 'README.md' keywords = ['data', 'database', 'seed', 'storage'] @@ -29,10 +29,10 @@ dependencies = [ 'sentry-sdk', 'tenacity', # DSW - "dsw-command-queue==4.4.0", - "dsw-config==4.4.0", - "dsw-database==4.4.0", - "dsw-storage==4.4.0", + "dsw-command-queue==4.4.1", + "dsw-config==4.4.1", + "dsw-database==4.4.1", + "dsw-storage==4.4.1", ] [project.urls] diff --git a/packages/dsw-database/CHANGELOG.md b/packages/dsw-database/CHANGELOG.md index 86fc5855..950741c9 100644 --- a/packages/dsw-database/CHANGELOG.md +++ b/packages/dsw-database/CHANGELOG.md @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [4.4.1] + +Released for version consistency with other DSW tools. + ## [4.4.0] Released for version consistency with other DSW tools. @@ -206,3 +210,4 @@ Released for version consistency with other DSW tools. [4.3.0]: /../../tree/v4.3.0 [4.3.1]: /../../tree/v4.3.1 [4.4.0]: /../../tree/v4.4.0 +[4.4.1]: /../../tree/v4.4.1 diff --git a/packages/dsw-database/pyproject.toml b/packages/dsw-database/pyproject.toml index 02eecd82..5db01d14 100644 --- a/packages/dsw-database/pyproject.toml +++ b/packages/dsw-database/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'dsw-database' -version = "4.4.0" +version = "4.4.1" description = 'Library for managing DSW database' readme = 'README.md' keywords = ['dsw', 'database'] @@ -26,7 +26,7 @@ dependencies = [ 'psycopg[binary]', 'tenacity', # DSW - "dsw-config==4.4.0", + "dsw-config==4.4.1", ] [project.urls] diff --git a/packages/dsw-document-worker/CHANGELOG.md b/packages/dsw-document-worker/CHANGELOG.md index c8675608..236beb83 100644 --- a/packages/dsw-document-worker/CHANGELOG.md +++ b/packages/dsw-document-worker/CHANGELOG.md @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [4.4.1] + +Released for version consistency with other DSW tools. + ## [4.4.0] ### Changed @@ -252,3 +256,4 @@ Released for version consistency with other DSW tools. [4.3.0]: /../../tree/v4.3.0 [4.3.1]: /../../tree/v4.3.1 [4.4.0]: /../../tree/v4.4.0 +[4.4.1]: /../../tree/v4.4.1 diff --git a/packages/dsw-document-worker/dsw/document_worker/consts.py b/packages/dsw-document-worker/dsw/document_worker/consts.py index d7518d3c..30e12904 100644 --- a/packages/dsw-document-worker/dsw/document_worker/consts.py +++ b/packages/dsw-document-worker/dsw/document_worker/consts.py @@ -6,7 +6,7 @@ EXIT_SUCCESS = 0 NULL_UUID = '00000000-0000-0000-0000-000000000000' PROG_NAME = 'docworker' -VERSION = '4.4.0' +VERSION = '4.4.1' VAR_APP_CONFIG_PATH = 'APPLICATION_CONFIG_PATH' VAR_WORKDIR_PATH = 'WORKDIR_PATH' diff --git a/packages/dsw-document-worker/pyproject.toml b/packages/dsw-document-worker/pyproject.toml index 668a27d9..c8e9b8f2 100644 --- a/packages/dsw-document-worker/pyproject.toml +++ b/packages/dsw-document-worker/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'dsw-document-worker' -version = "4.4.0" +version = "4.4.1" description = 'Worker for assembling and transforming documents' readme = 'README.md' keywords = ['documents', 'generation', 'jinja2', 'pandoc', 'worker'] @@ -40,10 +40,10 @@ dependencies = [ 'weasyprint', 'XlsxWriter', # DSW - "dsw-command-queue==4.4.0", - "dsw-config==4.4.0", - "dsw-database==4.4.0", - "dsw-storage==4.4.0", + "dsw-command-queue==4.4.1", + "dsw-config==4.4.1", + "dsw-database==4.4.1", + "dsw-storage==4.4.1", ] [project.urls] diff --git a/packages/dsw-mailer/CHANGELOG.md b/packages/dsw-mailer/CHANGELOG.md index 47152c02..2e632e7d 100644 --- a/packages/dsw-mailer/CHANGELOG.md +++ b/packages/dsw-mailer/CHANGELOG.md @@ -7,11 +7,13 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [4.4.1] + ### Fixed - Fixed color handling for custom colors in emails - ## [4.4.0] Released for version consistency with other DSW tools. @@ -221,3 +223,4 @@ Released for version consistency with other DSW tools. [4.3.0]: /../../tree/v4.3.0 [4.3.1]: /../../tree/v4.3.1 [4.4.0]: /../../tree/v4.4.0 +[4.4.1]: /../../tree/v4.4.1 diff --git a/packages/dsw-mailer/dsw/mailer/consts.py b/packages/dsw-mailer/dsw/mailer/consts.py index de166557..20515568 100644 --- a/packages/dsw-mailer/dsw/mailer/consts.py +++ b/packages/dsw-mailer/dsw/mailer/consts.py @@ -5,7 +5,7 @@ DEFAULT_ENCODING = 'utf-8' NULL_UUID = '00000000-0000-0000-0000-000000000000' PROG_NAME = 'dsw-mailer' -VERSION = '4.4.0' +VERSION = '4.4.1' VAR_APP_CONFIG_PATH = 'APPLICATION_CONFIG_PATH' VAR_WORKDIR_PATH = 'WORKDIR_PATH' diff --git a/packages/dsw-mailer/pyproject.toml b/packages/dsw-mailer/pyproject.toml index be32694a..bd8b4dd2 100644 --- a/packages/dsw-mailer/pyproject.toml +++ b/packages/dsw-mailer/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'dsw-mailer' -version = "4.4.0" +version = "4.4.1" description = 'Worker for sending email notifications' readme = 'README.md' keywords = ['email', 'jinja2', 'notification', 'template'] @@ -31,9 +31,9 @@ dependencies = [ 'sentry-sdk', 'tenacity', # DSW - "dsw-command-queue==4.4.0", - "dsw-config==4.4.0", - "dsw-database==4.4.0", + "dsw-command-queue==4.4.1", + "dsw-config==4.4.1", + "dsw-database==4.4.1", ] [project.urls] diff --git a/packages/dsw-models/CHANGELOG.md b/packages/dsw-models/CHANGELOG.md index 4d482d2f..595bfe9f 100644 --- a/packages/dsw-models/CHANGELOG.md +++ b/packages/dsw-models/CHANGELOG.md @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [4.4.1] + +Released for version consistency with other DSW tools. + ## [4.4.0] Released for version consistency with other DSW tools. @@ -120,3 +124,4 @@ Released for version consistency with other DSW tools. [4.3.0]: /../../tree/v4.3.0 [4.3.1]: /../../tree/v4.3.1 [4.4.0]: /../../tree/v4.4.0 +[4.4.1]: /../../tree/v4.4.1 diff --git a/packages/dsw-models/pyproject.toml b/packages/dsw-models/pyproject.toml index 57888dab..4c4d4536 100644 --- a/packages/dsw-models/pyproject.toml +++ b/packages/dsw-models/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'dsw-models' -version = "4.4.0" +version = "4.4.1" description = 'Library with DSW models and basic IO operations' readme = 'README.md' keywords = ['dsw', 'config', 'yaml', 'parser'] diff --git a/packages/dsw-storage/CHANGELOG.md b/packages/dsw-storage/CHANGELOG.md index 40ffb0c4..5590d7c3 100644 --- a/packages/dsw-storage/CHANGELOG.md +++ b/packages/dsw-storage/CHANGELOG.md @@ -8,6 +8,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [4.4.1] + +Released for version consistency with other DSW tools. + ## [4.4.0] Released for version consistency with other DSW tools. @@ -187,3 +191,4 @@ Released for version consistency with other DSW tools. [4.3.0]: /../../tree/v4.3.0 [4.3.1]: /../../tree/v4.3.1 [4.4.0]: /../../tree/v4.4.0 +[4.4.1]: /../../tree/v4.4.1 diff --git a/packages/dsw-storage/pyproject.toml b/packages/dsw-storage/pyproject.toml index bac14f5b..5493120a 100644 --- a/packages/dsw-storage/pyproject.toml +++ b/packages/dsw-storage/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'dsw-storage' -version = "4.4.0" +version = "4.4.1" description = 'Library for managing DSW S3 storage' readme = 'README.md' keywords = ['dsw', 's3', 'bucket', 'storage'] @@ -26,7 +26,7 @@ dependencies = [ 'minio', 'tenacity', # DSW - "dsw-config==4.4.0", + "dsw-config==4.4.1", ] [project.urls] diff --git a/packages/dsw-tdk/CHANGELOG.md b/packages/dsw-tdk/CHANGELOG.md index b339333b..db1586ee 100644 --- a/packages/dsw-tdk/CHANGELOG.md +++ b/packages/dsw-tdk/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.4.1] + +Released for version consistency with other DSW tools. + ## [4.4.0] Released for version consistency with other DSW tools. @@ -409,3 +413,4 @@ Initial DSW Template Development Kit (versioned as part of the [DSW platform](ht [4.3.0]: /../../tree/v4.3.0 [4.3.1]: /../../tree/v4.3.1 [4.4.0]: /../../tree/v4.4.0 +[4.4.1]: /../../tree/v4.4.1 diff --git a/packages/dsw-tdk/dsw/tdk/consts.py b/packages/dsw-tdk/dsw/tdk/consts.py index faa01955..4aeb9d42 100644 --- a/packages/dsw-tdk/dsw/tdk/consts.py +++ b/packages/dsw-tdk/dsw/tdk/consts.py @@ -3,7 +3,7 @@ import re APP = 'dsw-tdk' -VERSION = '4.4.0' +VERSION = '4.4.1' METAMODEL_VERSION = 13 REGEX_SEMVER = re.compile(r'^[0-9]+\.[0-9]+\.[0-9]+$') diff --git a/packages/dsw-tdk/pyproject.toml b/packages/dsw-tdk/pyproject.toml index 582fd3b2..a111137a 100644 --- a/packages/dsw-tdk/pyproject.toml +++ b/packages/dsw-tdk/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'dsw-tdk' -version = "4.4.0" +version = "4.4.1" description = 'Data Stewardship Wizard Template Development Toolkit' readme = 'README.md' keywords = ['documents', 'dsw', 'jinja2', 'template', 'toolkit']