Skip to content

Commit 36493bc

Browse files
edcohen08thibaudcolas
authored andcommitted
more documentation
1 parent c262579 commit 36493bc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pattern_library/loader_tags.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,15 @@ def do_include(parser, token):
152152
)
153153

154154
def visit_extends(self, node, frame):
155-
"""Dupe of the jinja2.compiler.CodeGenerator visit_Extends
155+
"""This method serves as overriding the jinja extends tag
156+
Dupe of the jinja2.compiler.CodeGenerator visit_Extends
156157
except for
157158
self.writeline(
158159
"parent_template.new_context(context.get_all(), True,"
159160
f" {self.dump_local_context(frame)})"
160161
)
161-
which is how we pull in context from yaml files to extended templates
162+
which executes at runtime to pull in the dpl context
163+
Handles visiting extends
162164
"""
163165
from jinja2.compiler import CompilerExit
164166

@@ -214,7 +216,10 @@ def template_new_context(
214216
shared=False,
215217
locals=None, # noqa A002
216218
):
217-
"""Create a new :class:`Context` for this template. The vars
219+
"""This method serves as overriding the jinja include tag
220+
Is called as part of Template.render by jinja2 and is updated
221+
to pull in the dpl context
222+
Create a new :class:`Context` for this template. The vars
218223
provided will be passed to the template. Per default the globals
219224
are added to the context. If shared is set to `True` the data
220225
is passed as is to the context without adding the globals.

0 commit comments

Comments
 (0)