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

Unified Diff: cms/converters.py

Issue 5148261828526080: Issue 2119 - Add get_page_content template function. (Closed)
Patch Set: Created April 5, 2015, 12:03 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 | cms/utils.py » ('j') | cms/utils.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/converters.py
diff --git a/cms/converters.py b/cms/converters.py
index a59bf2ea26728ead3f5bd243e3c80b77b3aeefa5..81feb6ee3fde58684923aa60e85692ff08786506 100644
--- a/cms/converters.py
+++ b/cms/converters.py
@@ -292,6 +292,7 @@ class TemplateConverter(Converter):
globals = {
"get_string": self.get_string,
+ "get_page_content": self.get_page_content,
}
for dirname, dictionary in [("filters", filters), ("globals", globals)]:
@@ -342,6 +343,13 @@ class TemplateConverter(Converter):
default = localedata[name]
return jinja2.Markup(self.localize_string(name, default, localedata, html_escapes))
+ def get_page_content(self, page, locale=None):
+ from utils import get_page_params
kzar 2015/04/05 12:10:12 (I import this here as we have a circular dependen
Sebastian Noack 2015/04/05 12:50:17 This is usually an indicator, that something is wr
kzar 2015/04/05 13:25:08 I thought about that, and maybe I'm wrong, but I t
Sebastian Noack 2015/04/05 13:30:33 Cyclic dependencies aren't great. However, the log
+
+ page, format = page.rsplit(".")
Sebastian Noack 2015/04/05 12:50:17 I suppose you forgot the second argument to .rspli
kzar 2015/04/05 13:25:08 Done.
+ params = get_page_params(self._params["source"], locale, page, format)
kzar 2015/04/05 12:10:12 (I'm unsure if I should pass self._params["site_ur
Sebastian Noack 2015/04/05 12:50:17 Shouldn't you fallback to self._params["locale"] i
kzar 2015/04/05 13:25:08 Done.
+ return params["head"], params["body"]
Sebastian Noack 2015/04/05 12:50:17 I would rather return a dict here, to make the cal
kzar 2015/04/05 13:25:08 Done.
+
def linkify(self, page, locale=None, **attrs):
if locale is None:
locale = self._params["locale"]
« no previous file with comments | « no previous file | cms/utils.py » ('j') | cms/utils.py » ('J')

Powered by Google App Engine
This is Rietveld