diff options
author | Erik Johnston <erik@matrix.org> | 2016-01-18 15:29:41 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-01-18 15:29:41 +0000 |
commit | 866fe27e783697f74f45573d0eb202e3803fe756 (patch) | |
tree | bbb5f3a740bd32f93751e439d31402f5d3f579e9 | |
parent | Use static for const dicts (diff) | |
download | synapse-866fe27e783697f74f45573d0eb202e3803fe756.tar.xz |
Do for loop once at start
-rw-r--r-- | synapse/push/baserules.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/synapse/push/baserules.py b/synapse/push/baserules.py index d8a0eda9fa..8be47f0975 100644 --- a/synapse/push/baserules.py +++ b/synapse/push/baserules.py @@ -62,10 +62,6 @@ def make_base_append_rules(kind): elif kind == 'content': rules = BASE_APPEND_CONTENT_RULES - for r in rules: - r['priority_class'] = PRIORITY_CLASS_MAP[kind] - r['default'] = True # Deprecated, left for backwards compat - return rules @@ -75,10 +71,6 @@ def make_base_prepend_rules(kind): if kind == 'override': rules = BASE_PREPEND_OVERRIDE_RULES - for r in rules: - r['priority_class'] = PRIORITY_CLASS_MAP[kind] - r['default'] = True # Deprecated, left for backwards compat - return rules @@ -261,3 +253,20 @@ BASE_APPEND_UNDERRIDE_RULES = [ ] } ] + + +for r in BASE_APPEND_CONTENT_RULES: + r['priority_class'] = PRIORITY_CLASS_MAP['content'] + r['default'] = True + +for r in BASE_PREPEND_OVERRIDE_RULES: + r['priority_class'] = PRIORITY_CLASS_MAP['override'] + r['default'] = True + +for r in BASE_APPEND_OVRRIDE_RULES: + r['priority_class'] = PRIORITY_CLASS_MAP['override'] + r['default'] = True + +for r in BASE_APPEND_UNDERRIDE_RULES: + r['priority_class'] = PRIORITY_CLASS_MAP['underride'] + r['default'] = True |