#26253: TemplateResponse and SimpleTemplateResponse: error message causes 
TypeError
---------------------------------+--------------------------------------
     Reporter:  davidswelt       |                    Owner:  nobody
         Type:  Uncategorized    |                   Status:  new
    Component:  Template system  |                  Version:  1.9
     Severity:  Normal           |               Resolution:
     Keywords:  Teamplates       |             Triage Stage:  Unreviewed
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  1                |                    UI/UX:  0
---------------------------------+--------------------------------------
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * needs_tests:   => 0


Old description:

> When TemplateResponse or BasicTemplateResponse are called, a TypeError is
> thrown.
>
> This is because their __init__() creates a BackendTemplate giving only
> one argument to the constructor.
>
> The resulting error is obviously confusing and obfuscates the warning.
>
> The attached patch addresses the issue, although I am unsure whether one
> should assume, by default, that a DjangoTemplate was given.

New description:

 When `TemplateResponse` or `SimpleTemplateResponse` are called, a
 TypeError is thrown.

 This is because their `__init__() creates a `BackendTemplate` giving only
 one argument to the constructor.

 The resulting error is obviously confusing and obfuscates the warning.

 The attached patch addresses the issue, although I am unsure whether one
 should assume, by default, that a DjangoTemplate was given.

--

Comment:

 Can you provide code to reproduce the issue? I'm not entirely clear on it
 based on the description. Is the issue relevant on master or only in 1.9
 that has the deprecation path? If only 1.9, the problem may not be severe
 enough to warrant being patched there.

 I edited the description to change `BaseTemplateResponse` to
 `SimpleTemplateResponse` since there's no class in Django with the former
 name. Please edit again if it should be something else.

--
Ticket URL: <https://code.djangoproject.com/ticket/26253#comment:1>
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/068.dfd75d04fabdd440152c0e9f6c0b767d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to