Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: filters/get_subscriptions.py

Issue 29337941: Issue 3750 - Avoid re-generating subscription list for each locale (Closed)
Patch Set: Created March 8, 2016, 3:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: filters/get_subscriptions.py
diff --git a/filters/get_subscriptions.py b/filters/get_subscriptions.py
index d5d20768584f4788fab1b1cc46ae68afb35a90b7..4672df367ea75b6c9d20dd8d20d86c1a79e11215 100644
--- a/filters/get_subscriptions.py
+++ b/filters/get_subscriptions.py
@@ -19,8 +19,12 @@ import tarfile
import urllib
import logging
from ConfigParser import SafeConfigParser
+subscriptions = None
def get_subscriptions(_):
Wladimir Palant 2016/03/09 11:12:27 This shouldn't be a filter but rather a global fun
Sebastian Noack 2016/03/09 11:18:17 I agree that this should rather be a global. Howev
Wladimir Palant 2016/03/09 11:25:51 That's fine IMHO, with something like this functio
Sebastian Noack 2016/03/09 11:54:18 Whether you think it's safe or not, jinja's optimi
Wladimir Palant 2016/03/09 13:50:15 This makes sense because for filters same input sh
+ global subscriptions
+ if not subscriptions is None:
+ return subscriptions
try:
from sitescripts.subscriptions import subscriptionParser
except ImportError:
@@ -57,4 +61,5 @@ def get_subscriptions(_):
subscriptionParser.get_settings = orig_get_settings
subscriptionParser.calculate_supplemented(result)
- return result.values()
+ subscriptions = result.values()
+ return subscriptions
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld