From a0bebeda8b5fa4130cc634b5bd9d0b1bd454713e Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Tue, 26 May 2015 10:14:15 +0100 Subject: [PATCH] SYN-390: Don't modify the dictionary returned from the data store --- synapse/rest/client/v1/push_rule.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/synapse/rest/client/v1/push_rule.py b/synapse/rest/client/v1/push_rule.py index d4e7ab220..bd759a258 100644 --- a/synapse/rest/client/v1/push_rule.py +++ b/synapse/rest/client/v1/push_rule.py @@ -118,11 +118,14 @@ class PushRuleRestServlet(ClientV1RestServlet): user.to_string() ) - for r in rawrules: - r["conditions"] = json.loads(r["conditions"]) - r["actions"] = json.loads(r["actions"]) + ruleslist = [] + for rawrule in rawrules: + rule = dict(rawrule) + rule["conditions"] = json.loads(rawrule["conditions"]) + rule["actions"] = json.loads(rawrule["actions"]) + ruleslist.append(rule) - ruleslist = baserules.list_with_base_rules(rawrules, user) + ruleslist = baserules.list_with_base_rules(ruleslist, user) rules = {'global': {}, 'device': {}}