              if self.parent_name_expr:
                  error_msg += " Got this from the %r variable." % self.parent_name_expr #TODO nice repr.
              raise TemplateSyntaxError, error_msg
          try:
              source, origin = find_template_source(parent, self.template_dirs)
          except TemplateDoesNotExist:
              raise TemplateSyntaxError, "Template %r cannot be extended, because it doesn't exist" % parent
 
</s> remove This tag may be used in two ways: ``{% extends "base.html" %}`` (with quotes)
uses the literal value "base.html" as the name of the parent template to
extend, or ``{% extends variable %}`` uses the value of ``variable`` as the
name of the parent template to extend.
 </s> add This tag may be used in two ways: 

   * ``{% extends "base.html" %}`` (with quotes) uses the literal value
     "base.html" as the name of the parent template to extend

   * ``{% extends variable %}`` uses the value of ``variable`` as either the
     name of the parent template to extend (if it evaluates to a string,) or
     as the parent tempate itelf (if it evaluates to a Template object). </s> remove     or ``{% extends variable %}`` uses the value of ``variable`` as the name
    of the parent template to extend.
 </s> add     or ``{% extends variable %}`` uses the value of ``variable`` as either the
    name of the parent template to extend (if it evaluates to a string,) or as
    the parent tempate itelf (if it evaluates to a Template object).
        if hasattr(parent, 'render'):
            return parent
              if self.parent_name_expr:
                  error_msg += " Got this from the %r variable." % self.parent_name_expr #TODO nice repr.
              raise TemplateSyntaxError, error_msg
        if hasattr(parent, 'render'):
            return parent
          try:
              source, origin = find_template_source(parent, self.template_dirs)
          except TemplateDoesNotExist:
              raise TemplateSyntaxError, "Template %r cannot be extended, because it doesn't exist" % parent
keep keep add keep keep keep keep
 Fixed #1650: the {% extends %} tag now can extend a Template object passed into the context.  Thanks, clelland@gmail.com.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3465 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/template/loader_tags.py