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

Side by Side Diff: sitescripts/utils.py

Issue 11481051: Update stats processing (Closed)
Patch Set: Fixed two presentation issues Created Aug. 24, 2013, 1:11 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2013 Eyeo GmbH 4 # Copyright (C) 2006-2013 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 def get_unescaped_template_environment(): 134 def get_unescaped_template_environment():
135 """ 135 """
136 Returns a Jinja2 template environment without autoescaping. Don't use this t o 136 Returns a Jinja2 template environment without autoescaping. Don't use this t o
137 generate HTML files! 137 generate HTML files!
138 """ 138 """
139 from sitescripts.templateFilters import filters 139 from sitescripts.templateFilters import filters
140 import jinja2 140 import jinja2
141 env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath)) 141 env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath))
142 env.filters.update(filters) 142 env.filters.update(filters)
143 return env 143 return env
144
145 def get_custom_template_environment(additional_filters):
146 """
147 Returns a custom Jinja2 template environment with additional filters.
148 """
149 from sitescripts.templateFilters import filters
150 import jinja2
151 env = jinja2.Environment(loader=jinja2.FileSystemLoader(siteScriptsPath), auto escape=True, extensions=['jinja2.ext.autoescape'])
Sebastian Noack 2013/08/26 16:05:22 You don't need to add the autoescape extesnion to
152 env.filters.update(filters)
153 env.filters.update(additional_filters)
154 return env
OLDNEW
« sitescripts/stats/bin/pagegenerator.py ('K') | « sitescripts/templateFilters.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld