Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Carl Meyer authored February 25, 2013
4  django/template/base.py
@@ -861,7 +861,7 @@ def __repr__(self):
861 861
     def render(self, context):
862 862
         return self.s
863 863
 
864  
-def _render_value_in_context(value, context):
  864
+def render_value_in_context(value, context):
865 865
     """
866 866
     Converts any value to a string to become part of a rendered template. This
867 867
     means escaping, if required, and conversion to a unicode object. If value
@@ -891,7 +891,7 @@ def render(self, context):
891 891
             # control (e.g. exception rendering). In that case, we fail
892 892
             # quietly.
893 893
             return ''
894  
-        return _render_value_in_context(output, context)
  894
+        return render_value_in_context(output, context)
895 895
 
896 896
 # Regex for token keyword arguments
897 897
 kwarg_re = re.compile(r"(?:(\w+)=)?(.+)")
6  django/template/defaulttags.py
@@ -13,7 +13,7 @@
13 13
     BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END,
14 14
     SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END,
15 15
     VARIABLE_ATTRIBUTE_SEPARATOR, get_library, token_kwargs, kwarg_re,
16  
-    _render_value_in_context)
  16
+    render_value_in_context)
17 17
 from django.template.smartif import IfParser, Literal
18 18
 from django.template.defaultfilters import date
19 19
 from django.utils.encoding import smart_text
@@ -78,7 +78,7 @@ def render(self, context):
78 78
             return ''
79 79
         if not self.escape:
80 80
             value = mark_safe(value)
81  
-        return _render_value_in_context(value, context)
  81
+        return render_value_in_context(value, context)
82 82
 
83 83
 class DebugNode(Node):
84 84
     def render(self, context):
@@ -111,7 +111,7 @@ def render(self, context):
111 111
             if value:
112 112
                 if not self.escape:
113 113
                     value = mark_safe(value)
114  
-                return _render_value_in_context(value, context)
  114
+                return render_value_in_context(value, context)
115 115
         return ''
116 116
 
117 117
 class ForNode(Node):
6  django/templatetags/i18n.py
@@ -3,7 +3,7 @@
3 3
 
4 4
 from django.template import (Node, Variable, TemplateSyntaxError,
5 5
     TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)
6  
-from django.template.base import _render_value_in_context
  6
+from django.template.base import render_value_in_context
7 7
 from django.template.defaulttags import token_kwargs
8 8
 from django.utils import six
9 9
 from django.utils import translation
@@ -87,7 +87,7 @@ def render(self, context):
87 87
             self.filter_expression.var.message_context = (
88 88
                 self.message_context.resolve(context))
89 89
         output = self.filter_expression.resolve(context)
90  
-        value = _render_value_in_context(output, context)
  90
+        value = render_value_in_context(output, context)
91 91
         if self.asvar:
92 92
             context[self.asvar] = value
93 93
             return ''
@@ -143,7 +143,7 @@ def render(self, context, nested=False):
143 143
                 result = translation.pgettext(message_context, singular)
144 144
             else:
145 145
                 result = translation.ugettext(singular)
146  
-        data = dict([(v, _render_value_in_context(context.get(v, ''), context)) for v in vars])
  146
+        data = dict([(v, render_value_in_context(context.get(v, ''), context)) for v in vars])
147 147
         context.pop()
148 148
         try:
149 149
             result = result % data

0 notes on commit 3ded2ae

Please sign in to comment.
Something went wrong with that request. Please try again.