Skip to content

Commit

Permalink
Remove leading underscore from a function that's all growed up now.
Browse files Browse the repository at this point in the history
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
carljm committed Feb 25, 2013
1 parent 8f839aa commit 3ded2ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions django/template/base.py
Expand Up @@ -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
Expand Down Expand Up @@ -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+)=)?(.+)")
Expand Down
6 changes: 3 additions & 3 deletions django/template/defaulttags.py
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions django/templatetags/i18n.py
Expand Up @@ -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
Expand Down Expand Up @@ -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 ''
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3ded2ae

Please sign in to comment.