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

Unified Diff: cms/converters.py

Issue 6364489058353152: Issue 2126 - Adapted CMS for living in its own repository rather than sitescripts (Closed)
Patch Set: Added .pyo to ignore files Created March 12, 2015, 4:22 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 | « cms/bin/test_server.py ('k') | runserver.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/converters.py
===================================================================
--- a/cms/converters.py
+++ b/cms/converters.py
@@ -11,17 +11,16 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
import os, imp, re, jinja2, markdown
-from ..utils import get_custom_template_environment
# Monkey-patch Markdown's isBlockLevel function to ensure that no paragraphs are
# inserted into the <head> tag
orig_isBlockLevel = markdown.util.isBlockLevel
def isBlockLevel(tag):
if tag == "head":
return True
else:
@@ -221,17 +220,18 @@ class TemplateConverter(Converter):
exec code in module.__dict__
func = os.path.basename(root)
if not hasattr(module, func):
raise Exception("Expected function %s not found in filter file %s" % (func, filename))
filters[func] = getattr(module, func)
filters[func].module_ref = module # Prevent garbage collection
- self._env = get_custom_template_environment(filters, self._SourceLoader(self._params["source"]))
+ self._env = jinja2.Environment(loader=self._SourceLoader(self._params["source"]), autoescape=True)
+ self._env.filters.update(filters)
def get_html(self, source):
template = self._env.from_string(source)
return template.render(self._params)
def translate(self, name, page=None, links=[]):
if page == None:
localedata = self._params["localedata"]
« no previous file with comments | « cms/bin/test_server.py ('k') | runserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld