You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our codebase we have overridden the new_context method on the Template class. I noticed Context.derived uses the builtin Jinja new_context function (which Template.new_context() delegates its work to):
We would like to use the custom new_context function/method in Context.derived as well. The first thing that comes to mind is to override the derived method but although it is not mark as a private method, its docstring says Internal helper function.
Is it safe to override Context.derived? What is the recommended way to achieve this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In our codebase we have overridden the
new_context
method on theTemplate
class. I noticedContext.derived
uses the builtin Jinjanew_context
function (whichTemplate.new_context()
delegates its work to):jinja/src/jinja2/runtime.py
Line 91 in 9dad679
jinja/src/jinja2/runtime.py
Lines 308 to 318 in 9dad679
We would like to use the custom
new_context
function/method inContext.derived
as well. The first thing that comes to mind is to override thederived
method but although it is not mark as a private method, its docstring saysInternal helper function
.Is it safe to override
Context.derived
? What is the recommended way to achieve this?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions