From 42474371dbd0d5f66b2324295b1c77643a2cdf1c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 8 Feb 2026 20:56:09 -0600 Subject: [PATCH 1/3] fix: fix importer `get_keys()` logic to honor class attribute so subclass can just say e.g. `key = "id"` --- src/wuttasync/importing/base.py | 6 ++++-- tests/importing/test_base.py | 17 +++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/wuttasync/importing/base.py b/src/wuttasync/importing/base.py index dd65190..183c1b9 100644 --- a/src/wuttasync/importing/base.py +++ b/src/wuttasync/importing/base.py @@ -379,8 +379,10 @@ class Importer: # pylint: disable=too-many-instance-attributes,too-many-public- # nb. prefer 'keys' but use 'key' as fallback if "keys" in self.__dict__: keys = self.__dict__["keys"] - elif "key" in self.__dict__: - keys = self.__dict__["key"] + elif hasattr(self, "keys"): + keys = self.keys + elif hasattr(self, "key"): + keys = self.key else: keys = self.default_keys diff --git a/tests/importing/test_base.py b/tests/importing/test_base.py index 9f83ae3..cf49b1c 100644 --- a/tests/importing/test_base.py +++ b/tests/importing/test_base.py @@ -90,19 +90,24 @@ class TestImporter(DataTestCase): imp = self.make_importer(model_class=model.User) self.assertEqual(imp.get_keys(), ["uuid"]) - # class may define 'keys' + # object dict may define 'keys' imp = self.make_importer(model_class=model.User) - with patch.object(imp, "keys", new=["foo", "bar"], create=True): + with patch.dict(imp.__dict__, keys=["foo", "bar"]): self.assertEqual(imp.get_keys(), ["foo", "bar"]) + # class may define 'keys' + with patch.object(mod.Importer, "keys", new=["foo", "baz"], create=True): + imp = self.make_importer(model_class=model.User) + self.assertEqual(imp.get_keys(), ["foo", "baz"]) + # class may define 'key' - imp = self.make_importer(model_class=model.User) - with patch.object(imp, "key", new="whatever", create=True): + with patch.object(mod.Importer, "key", new="whatever", create=True): + imp = self.make_importer(model_class=model.User) self.assertEqual(imp.get_keys(), ["whatever"]) # class may define 'default_keys' - imp = self.make_importer(model_class=model.User) - with patch.object(imp, "default_keys", new=["baz", "foo"]): + with patch.object(mod.Importer, "default_keys", new=["baz", "foo"]): + imp = self.make_importer(model_class=model.User) self.assertEqual(imp.get_keys(), ["baz", "foo"]) def test_process_data(self): From 51f76c72e22c1446f03200ecbc797cb032eeed06 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 9 Feb 2026 21:04:39 -0600 Subject: [PATCH 2/3] fix: fix source/target data order for import diff warning email --- src/wuttasync/email-templates/import_export_warning.html.mako | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wuttasync/email-templates/import_export_warning.html.mako b/src/wuttasync/email-templates/import_export_warning.html.mako index 9be7770..cae4658 100644 --- a/src/wuttasync/email-templates/import_export_warning.html.mako +++ b/src/wuttasync/email-templates/import_export_warning.html.mako @@ -59,7 +59,7 @@
${model} - ${app.render_quantity(len(created) - max_diffs)} more records created in ${target_title} - not shown here
% endif - % for obj, source_data, target_data in updated[:max_diffs]: + % for obj, target_data, source_data in updated[:max_diffs]:
${model} updated in ${target_title}: ${obj}
<% diff = make_diff(target_data, source_data, nature="update") %>
From bfc45bd0f0725fe6e0ac11a4fc6b92b8ae97c0f5 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 13 Feb 2026 15:59:28 -0600 Subject: [PATCH 3/3] =?UTF-8?q?bump:=20version=200.5.0=20=E2=86=92=200.5.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ce2ae2..e100544 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to WuttaSync 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.5.1 (2026-02-13) + +### Fix + +- fix source/target data order for import diff warning email +- fix importer `get_keys()` logic to honor class attribute +- add date type coercion logic for CSV importer + ## v0.5.0 (2026-01-03) ### Feat diff --git a/pyproject.toml b/pyproject.toml index b61d057..d3db422 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "WuttaSync" -version = "0.5.0" +version = "0.5.1" description = "Wutta Framework for data import/export and real-time sync" readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}]