diff --git a/CHANGELOG.md b/CHANGELOG.md index e100544..6ce2ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,14 +5,6 @@ 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 d3db422..b61d057 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "WuttaSync" -version = "0.5.1" +version = "0.5.0" description = "Wutta Framework for data import/export and real-time sync" readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}] diff --git a/src/wuttasync/email-templates/import_export_warning.html.mako b/src/wuttasync/email-templates/import_export_warning.html.mako index cae4658..9be7770 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, target_data, source_data in updated[:max_diffs]: + % for obj, source_data, target_data in updated[:max_diffs]:
${model} updated in ${target_title}: ${obj}
<% diff = make_diff(target_data, source_data, nature="update") %>
diff --git a/src/wuttasync/importing/base.py b/src/wuttasync/importing/base.py index 183c1b9..dd65190 100644 --- a/src/wuttasync/importing/base.py +++ b/src/wuttasync/importing/base.py @@ -379,10 +379,8 @@ 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 hasattr(self, "keys"): - keys = self.keys - elif hasattr(self, "key"): - keys = self.key + elif "key" in self.__dict__: + keys = self.__dict__["key"] else: keys = self.default_keys diff --git a/tests/importing/test_base.py b/tests/importing/test_base.py index cf49b1c..9f83ae3 100644 --- a/tests/importing/test_base.py +++ b/tests/importing/test_base.py @@ -90,24 +90,19 @@ class TestImporter(DataTestCase): imp = self.make_importer(model_class=model.User) self.assertEqual(imp.get_keys(), ["uuid"]) - # object dict may define 'keys' + # class may define 'keys' imp = self.make_importer(model_class=model.User) - with patch.dict(imp.__dict__, keys=["foo", "bar"]): + with patch.object(imp, "keys", new=["foo", "bar"], create=True): 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' - with patch.object(mod.Importer, "key", new="whatever", create=True): - imp = self.make_importer(model_class=model.User) + imp = self.make_importer(model_class=model.User) + with patch.object(imp, "key", new="whatever", create=True): self.assertEqual(imp.get_keys(), ["whatever"]) # class may define 'default_keys' - with patch.object(mod.Importer, "default_keys", new=["baz", "foo"]): - imp = self.make_importer(model_class=model.User) + imp = self.make_importer(model_class=model.User) + with patch.object(imp, "default_keys", new=["baz", "foo"]): self.assertEqual(imp.get_keys(), ["baz", "foo"]) def test_process_data(self):