From 0b49d56707e512ac02154d76d62f32bae4b1c9be Mon Sep 17 00:00:00 2001 From: Adam Kelly Date: Sun, 26 Apr 2020 15:59:02 +0100 Subject: [PATCH] Don't allow data source to change the primary key of an object. --- fedireads/connectors/abstract_connector.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fedireads/connectors/abstract_connector.py b/fedireads/connectors/abstract_connector.py index 9013d6d0..6eb864a0 100644 --- a/fedireads/connectors/abstract_connector.py +++ b/fedireads/connectors/abstract_connector.py @@ -70,6 +70,9 @@ def update_from_mappings(obj, data, mappings): if not formatter: formatter = noop + if key == 'id': + continue + if has_attr(obj, key): obj.__setattr__(key, formatter(value)) return obj