From f516c2bcb2b44aa8e1180a334e055a873af249da Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Mon, 5 Sep 2016 20:35:29 +0200 Subject: Workflow: support dependencies between attributes Restore the attributes in the order they are declared in `SAVE_ATTRIBUTES` to allow for dependencies between attributes (required by the `SubscriptionWorkflow`). --- src/mailman/app/workflow.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/mailman/app/workflow.py') diff --git a/src/mailman/app/workflow.py b/src/mailman/app/workflow.py index 36fd7d611..cd9124993 100644 --- a/src/mailman/app/workflow.py +++ b/src/mailman/app/workflow.py @@ -143,5 +143,9 @@ class Workflow: self._next.clear() if state.step: self._next.append(state.step) - for attr, value in json.loads(state.data).items(): - setattr(self, attr, value) + data = json.loads(state.data) + for attr in self.SAVE_ATTRIBUTES: + try: + setattr(self, attr, data[attr]) + except KeyError: + pass -- cgit v1.2.3-70-g09d2