#21065: Internally choosing how to process a template is inconsistent
-----------------------------------------+--------------------
     Reporter:  Keryn Knight <django@…>  |      Owner:  nobody
         Type:  Uncategorized            |     Status:  new
    Component:  Uncategorized            |    Version:  1.5
     Severity:  Normal                   |   Keywords:
 Triage Stage:  Unreviewed               |  Has patch:  0
Easy pickings:  0                        |      UI/UX:  0
-----------------------------------------+--------------------
 
[https://github.com/django/django/tree/ec47de77d6a7bc9327047d157fb5706751413f18/django/template/base.py#L1201
 inclusion_tag] checks the following:
 * Is it a Template instance?
 * Or is it ''not'' a string, and ''is it iterable?'' '''is_iterable would
 allow genexps/dictionaries through'''
 * Both the above failed? Should be a string.
 
[https://github.com/django/django/tree/ec47de77d6a7bc9327047d157fb5706751413f18/django/template/loader.py#L159
 render_to_string] checks the following:
 * is it a ''list or tuple''? '''doesn't allow genexps/dictionaries/etc'''
 * No? It must be a string
 * '''doesn't account for being passed a Template instance at all'''
 
[https://github.com/django/django/tree/ec47de77d6a7bc9327047d157fb5706751413f18/django/template/response.py#L53
 SimpleTemplateResponse] checks the following:
 * is it a ''list or a tuple'' ('''consistent with render_to_string''')
 * No; is it a string?  ('''consistent with render_to_string''')
 * No; ok, it must be a template instance ('''inconsistent with
 render_to_string, sort of consistent with inclusion_tag''')

 I discovered this while trying to choose how to fix #20995, which would
 again be different; I don't really want to push a pull request for that
 one without knowing what the outcome of this is, though. It might be worth
 introducing a single function (`resolve_template` or something) which
 provides a consistent way to take an input and decide how to get from it
 to a Template instance.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21065>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/080.2fdad4f7bfdf29f77b8e3d2fe0e10eb1%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to