Commits

Anonymous committed 176a7df

boulder-oracle-sprint: Merged to [5511]

Comments (0)

Files changed (21)

django/contrib/admin/templatetags/admin_modify.py

             return cls.nodelists[klass]
     get_nodelist = classmethod(get_nodelist)
 
-    def iter_render(self, context):
+    def render(self, context):
         bound_field = template.resolve_variable(self.bound_field_var, context)
 
         context.push()
         context['bound_field'] = bound_field
 
-        for chunk in self.get_nodelist(bound_field.field.__class__).iter_render(context):
-            yield chunk
+        output = self.get_nodelist(bound_field.field.__class__).render(context)
         context.pop()
+        return output
 
 class FieldWrapper(object):
     def __init__(self, field ):
     def __init__(self, rel_var):
         self.rel_var = rel_var
 
-    def iter_render(self, context):
+    def render(self, context):
         relation = template.resolve_variable(self.rel_var, context)
         context.push()
         if relation.field.rel.edit_inline == models.TABULAR:
         original = context.get('original', None)
         bound_related_object = relation.bind(context['form'], original, bound_related_object_class)
         context['bound_related_object'] = bound_related_object
-        for chunk in loader.get_template(bound_related_object.template_name()).iter_render(context):
-            yield chunk
+        t = loader.get_template(bound_related_object.template_name())
+        output = t.render(context)
         context.pop()
+        return output
 
 def output_all(form_fields):
     return ''.join([str(f) for f in form_fields])

django/contrib/admin/templatetags/adminapplist.py

     def __init__(self, varname):
         self.varname = varname
 
-    def iter_render(self, context):
+    def render(self, context):
         from django.db import models
         from django.utils.text import capfirst
         app_list = []
                         'models': model_list,
                     })
         context[self.varname] = app_list
-        return ()
+        return ''
 
 def get_admin_app_list(parser, token):
     """

django/contrib/admin/templatetags/log.py

     def __repr__(self):
         return "<GetAdminLog Node>"
 
-    def iter_render(self, context):
+    def render(self, context):
         if self.user is None:
             context[self.varname] = LogEntry.objects.all().select_related()[:self.limit]
         else:
             if not self.user.isdigit():
                 self.user = context[self.user].id
             context[self.varname] = LogEntry.objects.filter(user__id__exact=self.user).select_related()[:self.limit]
-        return ()
+        return ''
 
 class DoGetAdminLog:
     """

django/contrib/comments/templatetags/comments.py

         self.photo_options, self.rating_options = photo_options, rating_options
         self.is_public = is_public
 
-    def iter_render(self, context):
+    def render(self, context):
         from django.conf import settings
         from django.utils.text import normalize_newlines
         import base64
             try:
                 self.obj_id = template.resolve_variable(self.obj_id_lookup_var, context)
             except template.VariableDoesNotExist:
-                return
+                return ''
             # Validate that this object ID is valid for this content-type.
             # We only have to do this validation if obj_id_lookup_var is provided,
             # because do_comment_form() validates hard-coded object IDs.
             context['hash'] = Comment.objects.get_security_hash(context['options'], context['photo_options'], context['rating_options'], context['target'])
             context['logout_url'] = settings.LOGOUT_URL
             default_form = loader.get_template(COMMENT_FORM)
-        for chunk in default_form.iter_render(context):
-            yield chunk
+        output = default_form.render(context)
         context.pop()
+        return output
 
 class CommentCountNode(template.Node):
     def __init__(self, package, module, context_var_name, obj_id, var_name, free):
         self.context_var_name, self.obj_id = context_var_name, obj_id
         self.var_name, self.free = var_name, free
 
-    def iter_render(self, context):
+    def render(self, context):
         from django.conf import settings
         manager = self.free and FreeComment.objects or Comment.objects
         if self.context_var_name is not None:
             content_type__app_label__exact=self.package,
             content_type__model__exact=self.module, site__id__exact=settings.SITE_ID).count()
         context[self.var_name] = comment_count
-        return ()
+        return ''
 
 class CommentListNode(template.Node):
     def __init__(self, package, module, context_var_name, obj_id, var_name, free, ordering, extra_kwargs=None):
         self.ordering = ordering
         self.extra_kwargs = extra_kwargs or {}
 
-    def iter_render(self, context):
+    def render(self, context):
         from django.conf import settings
         get_list_function = self.free and FreeComment.objects.filter or Comment.objects.get_list_with_karma
         if self.context_var_name is not None:
             try:
                 self.obj_id = template.resolve_variable(self.context_var_name, context)
             except template.VariableDoesNotExist:
-                return ()
+                return ''
         kwargs = {
             'object_id__exact': self.obj_id,
             'content_type__app_label__exact': self.package,
                 comment_list = [c for c in comment_list if not c.is_hidden or (user_id == c.user_id)]
 
         context[self.var_name] = comment_list
-        return ()
+        return ''
 
 class DoCommentForm:
     """

django/core/servers/basehttp.py

         """
         if not self.result_is_file() and not self.sendfile():
             for data in self.result:
-                self.write(data, False)
+                self.write(data)
             self.finish_content()
         self.close()
 
         else:
             self._write('Status: %s\r\n' % self.status)
 
-    def write(self, data, flush=True):
+    def write(self, data):
         """'write()' callable as specified by PEP 333"""
 
         assert type(data) is StringType,"write() argument must be string"
 
         # XXX check Content-Length and truncate if too many bytes written?
         self._write(data)
-        if flush:
-            self._flush()
+        self._flush()
 
     def sendfile(self):
         """Platform-specific file transmission
         if not self.headers_sent:
             self.headers['Content-Length'] = "0"
             self.send_headers()
+        else:
+            pass # XXX check if content-length was too short?
 
     def close(self):
         try:

django/http/__init__.py

         content = ''.join(self._container)
         if isinstance(content, unicode):
             content = content.encode(self._charset)
-
-        # If self._container was an iterator, we have just exhausted it, so we
-        # need to save the results for anything else that needs access
-        if not self._is_string:
-            self._container = [content]
-            self._is_string = True
         return content
 
     def _set_content(self, value):
     content = property(_get_content, _set_content)
 
     def __iter__(self):
-        for chunk in self._container:
-            if isinstance(chunk, unicode):
-                chunk = chunk.encode(self._charset)
-            yield chunk
+        self._iterator = self._container.__iter__()
+        return self
+
+    def next(self):
+        chunk = self._iterator.next()
+        if isinstance(chunk, unicode):
+            chunk = chunk.encode(self._charset)
+        return chunk
 
     def close(self):
         if hasattr(self._container, 'close'):

django/oldforms/__init__.py

         return data
     html2python = staticmethod(html2python)
 
-    def iter_render(self, data):
-        # this even needed?
-        return (self.render(data),)
-
     def render(self, data):
         raise NotImplementedError
 

django/shortcuts/__init__.py

 from django.db.models.manager import Manager
 
 def render_to_response(*args, **kwargs):
-    return HttpResponse(loader.render_to_iter(*args, **kwargs))
+    return HttpResponse(loader.render_to_string(*args, **kwargs))
 load_and_render = render_to_response # For backwards compatibility.
 
 def get_object_or_404(klass, *args, **kwargs):

django/template/__init__.py

 '\n<html>\n\n</html>\n'
 """
 import re
-import types
 from inspect import getargspec
 from django.conf import settings
 from django.template.context import Context, RequestContext, ContextPopException
             for subnode in node:
                 yield subnode
 
-    def iter_render(self, context):
+    def render(self, context):
         "Display stage -- can be called many times"
-        return self.nodelist.iter_render(context)
-
-    def render(self, context):
-        return ''.join(self.iter_render(context))
+        return self.nodelist.render(context)
 
 def compile_string(template_string, origin):
     "Compiles template_string into NodeList ready for rendering"
             del bits[0]
     return current
 
-class NodeBase(type):
-    def __new__(cls, name, bases, attrs):
-        """
-        Ensures that either a 'render' or 'render_iter' method is defined on
-        any Node sub-class. This avoids potential infinite loops at runtime.
-        """
-        if not (isinstance(attrs.get('render'), types.FunctionType) or
-                isinstance(attrs.get('iter_render'), types.FunctionType)):
-            raise TypeError('Unable to create Node subclass without either "render" or "iter_render" method.')
-        return type.__new__(cls, name, bases, attrs)
-
 class Node(object):
-    __metaclass__ = NodeBase
-
-    def iter_render(self, context):
-        return (self.render(context),)
-
     def render(self, context):
         "Return the node rendered as a string"
-        return ''.join(self.iter_render(context))
+        pass
 
     def __iter__(self):
         yield self
 
 class NodeList(list):
     def render(self, context):
-        return ''.join(self.iter_render(context))
-
-    def iter_render(self, context):
+        bits = []
         for node in self:
-            for chunk in node.iter_render(context):
-                yield chunk
+            if isinstance(node, Node):
+                bits.append(self.render_node(node, context))
+            else:
+                bits.append(node)
+        return ''.join(bits)
 
     def get_nodes_by_type(self, nodetype):
         "Return a list of all nodes of the given type"
             nodes.extend(node.get_nodes_by_type(nodetype))
         return nodes
 
+    def render_node(self, node, context):
+        return(node.render(context))
+
 class DebugNodeList(NodeList):
-    def iter_render(self, context):
-        for node in self:
-            if not isinstance(node, Node):
-                yield node
-                continue
-            try:
-                for chunk in node.iter_render(context):
-                    yield chunk
-            except TemplateSyntaxError, e:
-                if not hasattr(e, 'source'):
-                    e.source = node.source
-                raise
-            except Exception, e:
-                from sys import exc_info
-                wrapped = TemplateSyntaxError('Caught an exception while rendering: %s' % e)
-                wrapped.source = node.source
-                wrapped.exc_info = exc_info()
-                raise wrapped
+    def render_node(self, node, context):
+        try:
+            result = node.render(context)
+        except TemplateSyntaxError, e:
+            if not hasattr(e, 'source'):
+                e.source = node.source
+            raise
+        except Exception, e:
+            from sys import exc_info
+            wrapped = TemplateSyntaxError('Caught an exception while rendering: %s' % e)
+            wrapped.source = node.source
+            wrapped.exc_info = exc_info()
+            raise wrapped
+        return result
 
 class TextNode(Node):
     def __init__(self, s):
     def __repr__(self):
         return "<Text Node: '%s'>" % self.s[:25]
 
-    def iter_render(self, context):
-        return (self.s,)
-
     def render(self, context):
         return self.s
 
         else:
             return output
 
-    def iter_render(self, context):
-        return (self.render(context),)
-
     def render(self, context):
         output = self.filter_expression.resolve(context)
         return self.encode_output(output)
             def __init__(self, vars_to_resolve):
                 self.vars_to_resolve = vars_to_resolve
 
-            #def iter_render(self, context):
-            #    return (self.render(context),)
-
             def render(self, context):
                 resolved_vars = [resolve_variable(var, context) for var in self.vars_to_resolve]
                 return func(*resolved_vars)
                 def __init__(self, vars_to_resolve):
                     self.vars_to_resolve = vars_to_resolve
 
-                def iter_render(self, context):
+                def render(self, context):
                     resolved_vars = [resolve_variable(var, context) for var in self.vars_to_resolve]
                     if takes_context:
                         args = [context] + resolved_vars
                         else:
                             t = get_template(file_name)
                         self.nodelist = t.nodelist
-                    return self.nodelist.iter_render(context_class(dict))
+                    return self.nodelist.render(context_class(dict))
 
             compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).__name__, InclusionNode)
             compile_func.__doc__ = func.__doc__

django/template/defaulttags.py

         for index in xrange(len(data)-1, -1, -1):
             yield data[index]
 
+
 register = Library()
 
 class CommentNode(Node):
-    def iter_render(self, context):
-        return ()
+    def render(self, context):
+        return ''
 
 class CycleNode(Node):
     def __init__(self, cyclevars, variable_name=None):
         self.counter = -1
         self.variable_name = variable_name
 
-    def iter_render(self, context):
-        return (self.render(context),)
-
     def render(self, context):
         self.counter += 1
         value = self.cyclevars[self.counter % self.cyclevars_len]
         return value
 
 class DebugNode(Node):
-    def iter_render(self, context):
+    def render(self, context):
         from pprint import pformat
-        for val in context:
-            yield pformat(val)
-        yield "\n\n"
-        yield pformat(sys.modules)
+        output = [pformat(val) for val in context]
+        output.append('\n\n')
+        output.append(pformat(sys.modules))
+        return ''.join(output)
 
 class FilterNode(Node):
     def __init__(self, filter_expr, nodelist):
         self.filter_expr, self.nodelist = filter_expr, nodelist
 
-    def iter_render(self, context):
+    def render(self, context):
         output = self.nodelist.render(context)
         # apply filters
         context.update({'var': output})
         filtered = self.filter_expr.resolve(context)
         context.pop()
-        return (filtered,)
+        return filtered
 
 class FirstOfNode(Node):
     def __init__(self, vars):
         self.vars = vars
 
-    def iter_render(self, context):
-        return (self.render(context),)
-
     def render(self, context):
         for var in self.vars:
             try:
         nodes.extend(self.nodelist_loop.get_nodes_by_type(nodetype))
         return nodes
 
-    def iter_render(self, context):
+    def render(self, context):
+        nodelist = NodeList()
         if 'forloop' in context:
             parentloop = context['forloop']
         else:
         context.push()
         try:
             values = self.sequence.resolve(context, True)
-            if values is None:
-                values = ()
-            elif not hasattr(values, '__len__'):
-                values = list(values)
         except VariableDoesNotExist:
-            values = ()
+            values = []
+        if values is None:
+            values = []
+        if not hasattr(values, '__len__'):
+            values = list(values)
         len_values = len(values)
         if self.reversed:
             values = reversed(values)
                 'parentloop': parentloop,
             }
             if unpack:
-                # If there are multiple loop variables, unpack the item into
-                # them.
+                # If there are multiple loop variables, unpack the item into them.
                 context.update(dict(zip(self.loopvars, item)))
             else:
                 context[self.loopvars[0]] = item
-
-            # We inline this to avoid the overhead since ForNode is pretty
-            # common.
             for node in self.nodelist_loop:
-                for chunk in node.iter_render(context):
-                    yield chunk
+                nodelist.append(node.render(context))
             if unpack:
                 # The loop variables were pushed on to the context so pop them
                 # off again. This is necessary because the tag lets the length
                 # context.
                 context.pop()
         context.pop()
+        return nodelist.render(context)
 
 class IfChangedNode(Node):
     def __init__(self, nodelist, *varlist):
         self._last_seen = None
         self._varlist = varlist
 
-    def iter_render(self, context):
+    def render(self, context):
         if 'forloop' in context and context['forloop']['first']:
             self._last_seen = None
         try:
             self._last_seen = compare_to
             context.push()
             context['ifchanged'] = {'firstloop': firstloop}
-            for chunk in self.nodelist.iter_render(context):
-                yield chunk
+            content = self.nodelist.render(context)
             context.pop()
+            return content
+        else:
+            return ''
 
 class IfEqualNode(Node):
     def __init__(self, var1, var2, nodelist_true, nodelist_false, negate):
     def __repr__(self):
         return "<IfEqualNode>"
 
-    def iter_render(self, context):
+    def render(self, context):
         try:
             val1 = resolve_variable(self.var1, context)
         except VariableDoesNotExist:
         except VariableDoesNotExist:
             val2 = None
         if (self.negate and val1 != val2) or (not self.negate and val1 == val2):
-            return self.nodelist_true.iter_render(context)
-        return self.nodelist_false.iter_render(context)
+            return self.nodelist_true.render(context)
+        return self.nodelist_false.render(context)
 
 class IfNode(Node):
     def __init__(self, bool_exprs, nodelist_true, nodelist_false, link_type):
         nodes.extend(self.nodelist_false.get_nodes_by_type(nodetype))
         return nodes
 
-    def iter_render(self, context):
+    def render(self, context):
         if self.link_type == IfNode.LinkTypes.or_:
             for ifnot, bool_expr in self.bool_exprs:
                 try:
                 except VariableDoesNotExist:
                     value = None
                 if (value and not ifnot) or (ifnot and not value):
-                    return self.nodelist_true.iter_render(context)
-            return self.nodelist_false.iter_render(context)
+                    return self.nodelist_true.render(context)
+            return self.nodelist_false.render(context)
         else:
             for ifnot, bool_expr in self.bool_exprs:
                 try:
                 except VariableDoesNotExist:
                     value = None
                 if not ((value and not ifnot) or (ifnot and not value)):
-                    return self.nodelist_false.iter_render(context)
-            return self.nodelist_true.iter_render(context)
+                    return self.nodelist_false.render(context)
+            return self.nodelist_true.render(context)
 
     class LinkTypes:
         and_ = 0,
         self.target, self.expression = target, expression
         self.var_name = var_name
 
-    def iter_render(self, context):
+    def render(self, context):
         obj_list = self.target.resolve(context, True)
         if obj_list == None: # target_var wasn't found in context; fail silently
             context[self.var_name] = []
-            return ()
+            return ''
         # List of dictionaries in the format
         # {'grouper': 'key', 'list': [list of contents]}.
         context[self.var_name] = [{'grouper':key, 'list':list(val)} for key, val in
             groupby(obj_list, lambda v, f=self.expression.resolve: f(v, True))]
-        return ()
+        return ''
 
 def include_is_allowed(filepath):
     for root in settings.ALLOWED_INCLUDE_ROOTS:
     def __init__(self, filepath, parsed):
         self.filepath, self.parsed = filepath, parsed
 
-    def iter_render(self, context):
+    def render(self, context):
         if not include_is_allowed(self.filepath):
             if settings.DEBUG:
-                return ("[Didn't have permission to include file]",)
+                return "[Didn't have permission to include file]"
             else:
                 return '' # Fail silently for invalid includes.
         try:
             output = ''
         if self.parsed:
             try:
-                return Template(output, name=self.filepath).iter_render(context)
+                t = Template(output, name=self.filepath)
+                return t.render(context)
             except TemplateSyntaxError, e:
                 if settings.DEBUG:
                     return "[Included template had syntax error: %s]" % e
                 else:
                     return '' # Fail silently for invalid included templates.
-        return (output,)
+        return output
 
 class LoadNode(Node):
-    def iter_render(self, context):
-        return ()
+    def render(self, context):
+        return ''
 
 class NowNode(Node):
     def __init__(self, format_string):
         self.format_string = format_string
 
-    def iter_render(self, context):
-        return (self.render(context),)
-
     def render(self, context):
         from datetime import datetime
         from django.utils.dateformat import DateFormat
     def __init__(self, tagtype):
         self.tagtype = tagtype
 
-    def iter_render(self, context):
-        return (self.render(context),)
-
     def render(self, context):
         return self.mapping.get(self.tagtype, '')
 
         self.args = args
         self.kwargs = kwargs
 
-    def iter_render(self, context):
+    def render(self, context):
         from django.core.urlresolvers import reverse, NoReverseMatch
         args = [arg.resolve(context) for arg in self.args]
         kwargs = dict([(k, v.resolve(context)) for k, v in self.kwargs.items()])
         try:
-            return (reverse(self.view_name, args=args, kwargs=kwargs),)
+            return reverse(self.view_name, args=args, kwargs=kwargs)
         except NoReverseMatch:
             try:
                 project_name = settings.SETTINGS_MODULE.split('.')[0]
                 return reverse(project_name + '.' + self.view_name, args=args, kwargs=kwargs)
             except NoReverseMatch:
-                return ()
+                return ''
 
 class WidthRatioNode(Node):
     def __init__(self, val_expr, max_expr, max_width):
         self.max_expr = max_expr
         self.max_width = max_width
 
-    def iter_render(self, context):
-        return (self.render(context),)
-
     def render(self, context):
         try:
             value = self.val_expr.resolve(context)
     def __repr__(self):
         return "<WithNode>"
 
-    def iter_render(self, context):
+    def render(self, context):
         val = self.var.resolve(context)
         context.push()
         context[self.name] = val
-        for chunk in self.nodelist.iter_render(context):
-            yield chunk
+        output = self.nodelist.render(context)
         context.pop()
+        return output
 
 #@register.tag
 def comment(parser, token):

django/template/loader.py

     """
     return Template(source, origin, name)
 
-def _render_setup(template_name, dictionary=None, context_instance=None):
+def render_to_string(template_name, dictionary=None, context_instance=None):
     """
-    Common setup code for render_to_string and render_to_iter.
+    Loads the given template_name and renders it with the given dictionary as
+    context. The template_name may be a string to load a single template using
+    get_template, or it may be a tuple to use select_template to find one of
+    the templates in the list. Returns a string.
     """
-    if dictionary is None:
-        dictionary = {}
+    dictionary = dictionary or {}
     if isinstance(template_name, (list, tuple)):
         t = select_template(template_name)
     else:
         context_instance.update(dictionary)
     else:
         context_instance = Context(dictionary)
-    return t, context_instance
-
-def render_to_string(template_name, dictionary=None, context_instance=None):
-    """
-    Loads the given template_name and renders it with the given dictionary as
-    context. The template_name may be a string to load a single template using
-    get_template, or it may be a tuple to use select_template to find one of
-    the templates in the list. Returns a string.
-    """
-    t, c = _render_setup(template_name, dictionary=dictionary, context_instance=context_instance)
-    return t.render(c)
-
-def render_to_iter(template_name, dictionary=None, context_instance=None):
-    """
-    Loads the given template_name and renders it with the given dictionary as
-    context. The template_name may be a string to load a single template using
-    get_template, or it may be a tuple to use select_template to find one of
-    the templates in the list. Returns a string.
-    """
-    t, c = _render_setup(template_name, dictionary=dictionary, context_instance=context_instance)
-    return t.iter_render(c)
-
+    return t.render(context_instance)
 
 def select_template(template_name_list):
     "Given a list of template names, returns the first that can be loaded."

django/template/loader_tags.py

     def __repr__(self):
         return "<Block Node: %s. Contents: %r>" % (self.name, self.nodelist)
 
-    def iter_render(self, context):
+    def render(self, context):
         context.push()
         # Save context in case of block.super().
         self.context = context
         context['block'] = self
-        for chunk in self.nodelist.iter_render(context):
-            yield chunk
+        result = self.nodelist.render(context)
         context.pop()
+        return result
 
     def super(self):
         if self.parent:
         else:
             return get_template_from_string(source, origin, parent)
 
-    def iter_render(self, context):
+    def render(self, context):
         compiled_parent = self.get_parent(context)
         parent_is_child = isinstance(compiled_parent.nodelist[0], ExtendsNode)
         parent_blocks = dict([(n.name, n) for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)])
                 parent_block.parent = block_node.parent
                 parent_block.add_parent(parent_block.nodelist)
                 parent_block.nodelist = block_node.nodelist
-        return compiled_parent.iter_render(context)
+        return compiled_parent.render(context)
 
 class ConstantIncludeNode(Node):
     def __init__(self, template_path):
                 raise
             self.template = None
 
-    def iter_render(self, context):
+    def render(self, context):
         if self.template:
-            return self.template.iter_render(context)
-        return ()
+            return self.template.render(context)
+        else:
+            return ''
 
 class IncludeNode(Node):
     def __init__(self, template_name):
         self.template_name = template_name
 
-    def iter_render(self, context):
+    def render(self, context):
         try:
             template_name = resolve_variable(self.template_name, context)
             t = get_template(template_name)
-            return t.iter_render(context)
+            return t.render(context)
         except TemplateSyntaxError, e:
             if settings.TEMPLATE_DEBUG:
                 raise
-            return ()
+            return ''
         except:
-            return () # Fail silently for invalid included templates.
+            return '' # Fail silently for invalid included templates.
 
 def do_block(parser, token):
     """

django/test/utils.py

 TEST_DATABASE_PREFIX = 'test_'
 
 def instrumented_test_render(self, context):
-    """
-    An instrumented Template render method, providing a signal that can be
-    intercepted by the test system Client.
+    """An instrumented Template render method, providing a signal 
+    that can be intercepted by the test system Client
+    
     """
     dispatcher.send(signal=signals.template_rendered, sender=self, template=self, context=context)
     return self.nodelist.render(context)
-
-def instrumented_test_iter_render(self, context):
-    """
-    An instrumented Template iter_render method, providing a signal that can be
-    intercepted by the test system Client.
-    """
-    for chunk in self.nodelist.iter_render(context):
-        yield chunk
-    dispatcher.send(signal=signals.template_rendered, sender=self, template=self, context=context)
     
 class TestSMTPConnection(object):
     """A substitute SMTP connection for use during test sessions.
         
     """
     Template.original_render = Template.render
-    Template.original_iter_render = Template.iter_render
     Template.render = instrumented_test_render
-    Template.iter_render = instrumented_test_render
     
     mail.original_SMTPConnection = mail.SMTPConnection
     mail.SMTPConnection = TestSMTPConnection
         
     """
     Template.render = Template.original_render
-    Template.iter_render = Template.original_iter_render
-    del Template.original_render, Template.original_iter_render
+    del Template.original_render
     
     mail.SMTPConnection = mail.original_SMTPConnection
     del mail.original_SMTPConnection

django/views/debug.py

         'template_does_not_exist': template_does_not_exist,
         'loader_debug_info': loader_debug_info,
     })
-    return HttpResponseServerError(t.iter_render(c), mimetype='text/html')
+    return HttpResponseServerError(t.render(c), mimetype='text/html')
 
 def technical_404_response(request, exception):
     "Create a technical 404 error response. The exception should be the Http404."
         'request_protocol': request.is_secure() and "https" or "http",
         'settings': get_safe_settings(),
     })
-    return HttpResponseNotFound(t.iter_render(c), mimetype='text/html')
+    return HttpResponseNotFound(t.render(c), mimetype='text/html')
 
 def empty_urlconf(request):
     "Create an empty URLconf 404 error response."
     c = Context({
         'project_name': settings.SETTINGS_MODULE.split('.')[0]
     })
-    return HttpResponseNotFound(t.iter_render(c), mimetype='text/html')
+    return HttpResponseNotFound(t.render(c), mimetype='text/html')
 
 def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_name=None):
     """

django/views/defaults.py

             The path of the requested URL (e.g., '/app/pages/bad_page/')
     """
     t = loader.get_template(template_name) # You need to create a 404.html template.
-    return http.HttpResponseNotFound(t.iter_render(RequestContext(request, {'request_path': request.path})))
+    return http.HttpResponseNotFound(t.render(RequestContext(request, {'request_path': request.path})))
 
 def server_error(request, template_name='500.html'):
     """
     Context: None
     """
     t = loader.get_template(template_name) # You need to create a 500.html template.
-    return http.HttpResponseServerError(t.iter_render(Context({})))
+    return http.HttpResponseServerError(t.render(Context({})))

django/views/generic/create_update.py

             c[key] = value()
         else:
             c[key] = value
-    return HttpResponse(t.iter_render(c))
+    return HttpResponse(t.render(c))
 
 def update_object(request, model, object_id=None, slug=None,
         slug_field=None, template_name=None, template_loader=loader,
             c[key] = value()
         else:
             c[key] = value
-    response = HttpResponse(t.iter_render(c))
+    response = HttpResponse(t.render(c))
     populate_xheaders(request, response, model, getattr(object, object._meta.pk.attname))
     return response
 
                 c[key] = value()
             else:
                 c[key] = value
-        response = HttpResponse(t.iter_render(c))
+        response = HttpResponse(t.render(c))
         populate_xheaders(request, response, model, getattr(object, object._meta.pk.attname))
         return response

django/views/generic/date_based.py

             c[key] = value()
         else:
             c[key] = value
-    return HttpResponse(t.iter_render(c), mimetype=mimetype)
+    return HttpResponse(t.render(c), mimetype=mimetype)
 
 def archive_year(request, year, queryset, date_field, template_name=None,
         template_loader=loader, extra_context=None, allow_empty=False,
             c[key] = value()
         else:
             c[key] = value
-    return HttpResponse(t.iter_render(c), mimetype=mimetype)
+    return HttpResponse(t.render(c), mimetype=mimetype)
 
 def archive_month(request, year, month, queryset, date_field,
         month_format='%b', template_name=None, template_loader=loader,
             c[key] = value()
         else:
             c[key] = value
-    return HttpResponse(t.iter_render(c), mimetype=mimetype)
+    return HttpResponse(t.render(c), mimetype=mimetype)
 
 def archive_week(request, year, week, queryset, date_field,
         template_name=None, template_loader=loader,
             c[key] = value()
         else:
             c[key] = value
-    return HttpResponse(t.iter_render(c), mimetype=mimetype)
+    return HttpResponse(t.render(c), mimetype=mimetype)
 
 def archive_day(request, year, month, day, queryset, date_field,
         month_format='%b', day_format='%d', template_name=None,
             c[key] = value()
         else:
             c[key] = value
-    return HttpResponse(t.iter_render(c), mimetype=mimetype)
+    return HttpResponse(t.render(c), mimetype=mimetype)
 
 def archive_today(request, **kwargs):
     """
             c[key] = value()
         else:
             c[key] = value
-    response = HttpResponse(t.iter_render(c), mimetype=mimetype)
+    response = HttpResponse(t.render(c), mimetype=mimetype)
     populate_xheaders(request, response, model, getattr(obj, obj._meta.pk.name))
     return response

django/views/generic/list_detail.py

         model = queryset.model
         template_name = "%s/%s_list.html" % (model._meta.app_label, model._meta.object_name.lower())
     t = template_loader.get_template(template_name)
-    return HttpResponse(t.iter_render(c), mimetype=mimetype)
+    return HttpResponse(t.render(c), mimetype=mimetype)
 
 def object_detail(request, queryset, object_id=None, slug=None,
         slug_field=None, template_name=None, template_name_field=None,
             c[key] = value()
         else:
             c[key] = value
-    response = HttpResponse(t.iter_render(c), mimetype=mimetype)
+    response = HttpResponse(t.render(c), mimetype=mimetype)
     populate_xheaders(request, response, model, getattr(obj, obj._meta.pk.name))
     return response

django/views/generic/simple.py

             dictionary[key] = value
     c = RequestContext(request, dictionary)
     t = loader.get_template(template)
-    return HttpResponse(t.iter_render(c), mimetype=mimetype)
+    return HttpResponse(t.render(c), mimetype=mimetype)
 
 def redirect_to(request, url, **kwargs):
     """

django/views/static.py

         'directory' : path + '/',
         'file_list' : files,
     })
-    return HttpResponse(t.iter_render(c))
+    return HttpResponse(t.render(c))
 
 def was_modified_since(header=None, mtime=0, size=0):
     """

docs/templates_python.txt

 
     While ``TEMPLATE_STRING_IF_INVALID`` can be a useful debugging tool,
     it is a bad idea to turn it on as a 'development default'.
-
+    
     Many templates, including those in the Admin site, rely upon the
     silence of the template system when a non-existent variable is
     encountered. If you assign a value other than ``''`` to
     ``TEMPLATE_STRING_IF_INVALID``, you will experience rendering
     problems with these templates and sites.
-
+    
     Generally, ``TEMPLATE_STRING_IF_INVALID`` should only be enabled
     in order to debug a specific template problem, then cleared
     once debugging is complete.
 
 When Django compiles a template, it splits the raw template text into
 ''nodes''. Each node is an instance of ``django.template.Node`` and has
-either a ``render()`` or ``iter_render()`` method. A compiled template is,
-simply, a list of ``Node`` objects. When you call ``render()`` on a compiled
-template object, the template calls ``render()`` on each ``Node`` in its node
-list, with the given context. The results are all concatenated together to
-form the output of the template.
+a ``render()`` method. A compiled template is, simply, a list of ``Node``
+objects. When you call ``render()`` on a compiled template object, the template
+calls ``render()`` on each ``Node`` in its node list, with the given context.
+The results are all concatenated together to form the output of the template.
 
 Thus, to define a custom template tag, you specify how the raw template tag is
 converted into a ``Node`` (the compilation function), and what the node's
-``render()`` or ``iter_render()`` method does.
+``render()`` method does.
 
 Writing the compilation function
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~
 
 The second step in writing custom tags is to define a ``Node`` subclass that
-has a ``render()`` method (we will discuss the ``iter_render()`` alternative
-in `Improving rendering speed`_, below).
+has a ``render()`` method.
 
 Continuing the above example, we need to define ``CurrentTimeNode``::
 
         def __init__(self, date_to_be_formatted, format_string):
             self.date_to_be_formatted = date_to_be_formatted
             self.format_string = format_string
-
+        
         def render(self, context):
             try:
                 actual_date = resolve_variable(self.date_to_be_formatted, context)
 
 .. _configuration:
 
-Improving rendering speed
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-For most practical purposes, the ``render()`` method on a ``Node`` will be
-sufficient and the simplest way to implement a new tag. However, if your
-template tag is expected to produce large strings via ``render()``, you can
-speed up the rendering process (and reduce memory usage) using iterative
-rendering via the ``iter_render()`` method.
-
-The ``iter_render()`` method should either be an iterator that yields string
-chunks, one at a time, or a method that returns a sequence of string chunks.
-The template renderer will join the successive chunks together when creating
-the final output. The improvement over the ``render()`` method here is that
-you do not need to create one large string containing all the output of the
-``Node``, instead you can produce the output in smaller chunks.
-
-By way of example, here's a trivial ``Node`` subclass that simply returns the
-contents of a file it is given::
-
-    class FileNode(Node):
-        def __init__(self, filename):
-            self.filename = filename
-
-        def iter_render(self):
-            for line in file(self.filename):
-                yield line
-
-For very large files, the full file contents will never be read entirely into
-memory when this tag is used, which is a useful optimisation.
-
-If you define an ``iter_render()`` method on your ``Node`` subclass, you do
-not need to define a ``render()`` method. The reverse is true as well: the
-default ``Node.iter_render()`` method will call your ``render()`` method if
-necessary. A useful side-effect of this is that you can develop a new tag
-using ``render()`` and producing all the output at once, which is easy to
-debug. Then you can rewrite the method as an iterator, rename it to
-``iter_render()`` and everything will still work.
-
-It is compulsory, however, to define *either* ``render()`` or ``iter_render()``
-in your subclass. If you omit them both, a ``TypeError`` will be raised when
-the code is imported.
-
 Configuring the template system in standalone mode
 ==================================================
 
 
 .. _settings file: ../settings/#using-settings-without-the-django-settings-module-environment-variable
 .. _settings documentation: ../settings/
-