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

Unified Diff: globals/has_string.py

Issue 29424810: Issue 5191 - Add Terms of Use to adblockplus.org homepage (Closed) Base URL: https://hg.adblockplus.org/web.adblockplus.org
Patch Set: Fixed has_string Created May 2, 2017, 8:43 a.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 | globals/platforms.py » ('j') | includes/index.tmpl » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: globals/has_string.py
===================================================================
new file mode 100644
--- /dev/null
+++ b/globals/has_string.py
@@ -0,0 +1,9 @@
+from jinja2 import contextfunction
+
+@contextfunction
+def has_string(context, name, page=None):
+ try:
+ if context['get_string'](name, page):
+ return True
+ except KeyError, RuntimeError:
+ return False
« no previous file with comments | « no previous file | globals/platforms.py » ('j') | includes/index.tmpl » ('J')

Powered by Google App Engine
This is Rietveld