Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove leading underscore from a function that's all growed up now.

This function is now the de facto standard function for rendering values in a
template, and is imported by two other built-in template modules. It shouldn't
have a leading underscore.
  • Loading branch information...
commit 3ded2aef71e35e00e9822a39b3805b31deb0eef5 1 parent 8f839aa
@carljm carljm authored
View
4 django/template/base.py
@@ -861,7 +861,7 @@ def __repr__(self):
def render(self, context):
return self.s
-def _render_value_in_context(value, context):
+def render_value_in_context(value, context):
"""
Converts any value to a string to become part of a rendered template. This
means escaping, if required, and conversion to a unicode object. If value
@@ -891,7 +891,7 @@ def render(self, context):
# control (e.g. exception rendering). In that case, we fail
# quietly.
return ''
- return _render_value_in_context(output, context)
+ return render_value_in_context(output, context)
# Regex for token keyword arguments
kwarg_re = re.compile(r"(?:(\w+)=)?(.+)")
View
6 django/template/defaulttags.py
@@ -13,7 +13,7 @@
BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END,
SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END,
VARIABLE_ATTRIBUTE_SEPARATOR, get_library, token_kwargs, kwarg_re,
- _render_value_in_context)
+ render_value_in_context)
from django.template.smartif import IfParser, Literal
from django.template.defaultfilters import date
from django.utils.encoding import smart_text
@@ -78,7 +78,7 @@ def render(self, context):
return ''
if not self.escape:
value = mark_safe(value)
- return _render_value_in_context(value, context)
+ return render_value_in_context(value, context)
class DebugNode(Node):
def render(self, context):
@@ -111,7 +111,7 @@ def render(self, context):
if value:
if not self.escape:
value = mark_safe(value)
- return _render_value_in_context(value, context)
+ return render_value_in_context(value, context)
return ''
class ForNode(Node):
View
6 django/templatetags/i18n.py
@@ -3,7 +3,7 @@
from django.template import (Node, Variable, TemplateSyntaxError,
TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)
-from django.template.base import _render_value_in_context
+from django.template.base import render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import six
from django.utils import translation
@@ -87,7 +87,7 @@ def render(self, context):
self.filter_expression.var.message_context = (
self.message_context.resolve(context))
output = self.filter_expression.resolve(context)
- value = _render_value_in_context(output, context)
+ value = render_value_in_context(output, context)
if self.asvar:
context[self.asvar] = value
return ''
@@ -143,7 +143,7 @@ def render(self, context, nested=False):
result = translation.pgettext(message_context, singular)
else:
result = translation.ugettext(singular)
- data = dict([(v, _render_value_in_context(context.get(v, ''), context)) for v in vars])
+ data = dict([(v, render_value_in_context(context.get(v, ''), context)) for v in vars])
context.pop()
try:
result = result % data
Please sign in to comment.
Something went wrong with that request. Please try again.