From 3ded2aef71e35e00e9822a39b3805b31deb0eef5 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Mon, 25 Feb 2013 00:33:29 -0700 Subject: [PATCH] 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. --- django/template/base.py | 4 ++-- django/template/defaulttags.py | 6 +++--- django/templatetags/i18n.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/django/template/base.py b/django/template/base.py index f43194de4a..c5bddaf63e 100644 --- a/django/template/base.py +++ b/django/template/base.py @@ -861,7 +861,7 @@ class TextNode(Node): 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 @@ class VariableNode(Node): # 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+)=)?(.+)") diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index dbb5b5a0cb..8a571fdbc5 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -13,7 +13,7 @@ from django.template.base import (Node, NodeList, Template, Context, Library, 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 @@ class CycleNode(Node): 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 @@ class FirstOfNode(Node): 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): diff --git a/django/templatetags/i18n.py b/django/templatetags/i18n.py index abb30f0e8c..110990eca7 100644 --- a/django/templatetags/i18n.py +++ b/django/templatetags/i18n.py @@ -3,7 +3,7 @@ import re 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 @@ class TranslateNode(Node): 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 @@ class BlockTranslateNode(Node): 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