Compare commits

...

3 commits

Author SHA1 Message Date
bfc45bd0f0 bump: version 0.5.0 → 0.5.1 2026-02-13 15:59:28 -06:00
51f76c72e2 fix: fix source/target data order for import diff warning email 2026-02-09 21:04:39 -06:00
42474371db fix: fix importer get_keys() logic to honor class attribute
so subclass can just say e.g. `key = "id"`
2026-02-08 20:56:09 -06:00
5 changed files with 25 additions and 10 deletions

View file

@ -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

View file

@ -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"}]

View file

@ -59,7 +59,7 @@
<h5>${model} - ${app.render_quantity(len(created) - max_diffs)} more records <em>created</em> in ${target_title} - not shown here</h5>
% endif
% for obj, source_data, target_data in updated[:max_diffs]:
% for obj, target_data, source_data in updated[:max_diffs]:
<h5>${model} <em>updated</em> in ${target_title}: ${obj}</h5>
<% diff = make_diff(target_data, source_data, nature="update") %>
<div style="padding-left: 2rem;">

View file

@ -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

View file

@ -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 'key'
# 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)
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)
with patch.object(imp, "default_keys", new=["baz", "foo"]):
self.assertEqual(imp.get_keys(), ["baz", "foo"])
def test_process_data(self):