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

Issue 6439145228468224: Added custom template loader to CMS in order to enable {% include %} and {% import %} in jinja temp… (Closed)

Created:
Dec. 11, 2013, 6:31 p.m. by Sebastian Noack
Modified:
Dec. 13, 2013, 2:21 p.m.
Reviewers:
Wladimir Palant
Visibility:
Public.

Description

Added custom template loader to CMS in order to enable {% include %} and {% import %} in jinja temp…

Patch Set 1 #

Total comments: 4

Patch Set 2 : Addressed comments #

Patch Set 3 : Adressed comments #

Total comments: 3

Patch Set 4 : Only allow inlcudes with escaped brackets in markdown #

Unified diffs Side-by-side diffs Delta from patch set Stats (+35 lines, -4 lines) Patch
M sitescripts/cms/converters.py View 1 2 3 5 chunks +31 lines, -2 lines 0 comments Download
M sitescripts/utils.py View 1 chunk +4 lines, -2 lines 0 comments Download

Messages

Total messages: 9
Sebastian Noack
Dec. 11, 2013, 6:32 p.m. (2013-12-11 18:32:19 UTC) #1
Wladimir Palant
Nice having somebody other than me work on this. http://codereview.adblockplus.org/6439145228468224/diff/5629499534213120/sitescripts/cms/sources.py File sitescripts/cms/sources.py (right): http://codereview.adblockplus.org/6439145228468224/diff/5629499534213120/sitescripts/cms/sources.py#newcode267 sitescripts/cms/sources.py:267: ...
Dec. 11, 2013, 6:46 p.m. (2013-12-11 18:46:02 UTC) #2
Sebastian Noack
Dec. 11, 2013, 7:30 p.m. (2013-12-11 19:30:42 UTC) #3
Sebastian Noack
http://codereview.adblockplus.org/6439145228468224/diff/5629499534213120/sitescripts/cms/sources.py File sitescripts/cms/sources.py (right): http://codereview.adblockplus.org/6439145228468224/diff/5629499534213120/sitescripts/cms/sources.py#newcode273 sitescripts/cms/sources.py:273: return self.source.read_file(template + '.tmpl'), None, None On 2013/12/11 18:46:02, ...
Dec. 11, 2013, 10:20 p.m. (2013-12-11 22:20:14 UTC) #4
Wladimir Palant
LGTM with the read_file => read_include change reverted. http://codereview.adblockplus.org/6439145228468224/diff/5629499534213120/sitescripts/cms/sources.py File sitescripts/cms/sources.py (right): http://codereview.adblockplus.org/6439145228468224/diff/5629499534213120/sitescripts/cms/sources.py#newcode273 sitescripts/cms/sources.py:273: return ...
Dec. 12, 2013, 7:16 a.m. (2013-12-12 07:16:54 UTC) #5
Sebastian Noack
Dec. 12, 2013, 10:37 a.m. (2013-12-12 10:37:46 UTC) #6
Wladimir Palant
http://codereview.adblockplus.org/6439145228468224/diff/5766466041282560/sitescripts/cms/converters.py File sitescripts/cms/converters.py (right): http://codereview.adblockplus.org/6439145228468224/diff/5766466041282560/sitescripts/cms/converters.py#newcode129 sitescripts/cms/converters.py:129: return re.sub(r'(?:<|\&lt\;)\?\s*include\s+([^\s<>"]+)\s*\?(?:>|\&gt\;)', resolve_include, text) Nope, we really don't want ...
Dec. 12, 2013, 12:51 p.m. (2013-12-12 12:51:05 UTC) #7
Sebastian Noack
http://codereview.adblockplus.org/6439145228468224/diff/5766466041282560/sitescripts/cms/converters.py File sitescripts/cms/converters.py (right): http://codereview.adblockplus.org/6439145228468224/diff/5766466041282560/sitescripts/cms/converters.py#newcode129 sitescripts/cms/converters.py:129: return re.sub(r'(?:<|\&lt\;)\?\s*include\s+([^\s<>"]+)\s*\?(?:>|\&gt\;)', resolve_include, text) On 2013/12/12 12:51:06, Wladimir Palant ...
Dec. 12, 2013, 1:54 p.m. (2013-12-12 13:54:39 UTC) #8
Wladimir Palant
Dec. 13, 2013, 2:01 p.m. (2013-12-13 14:01:45 UTC) #9
LGTM even though I don't really think that this is the best solution (see
below).

http://codereview.adblockplus.org/6439145228468224/diff/5766466041282560/site...
File sitescripts/cms/converters.py (right):

http://codereview.adblockplus.org/6439145228468224/diff/5766466041282560/site...
sitescripts/cms/converters.py:129: return
re.sub(r'(?:<|\&lt\;)\?\s*include\s+([^\s<>"]+)\s*\?(?:>|\&gt\;)',
resolve_include, text)
On 2013/12/12 13:54:39, sebastian wrote:
> I agree that we should do that only for markdown. But I went for an other
> approach, which doesn't require another regex to apply and having the include
> syntax defined in two places.

The other regexp applied to processing instructions in general and only fixed
that one bug - in a single line. You've implemented a more complex solution now
which IMHO is an overkill for a temporary workaround.

Whatever, I guess I can live with that solution as well...

Powered by Google App Engine
This is Rietveld