#37050: Improve simple_tag / simple_block_tag error message when as is used 
without
a variable name
-------------------------------------+-------------------------------------
     Reporter:  Shima Fallah         |                    Owner:  Shima
         Type:                       |  Fallah
  Cleanup/optimization               |                   Status:  closed
    Component:  Template system      |                  Version:  6.0
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

 * easy:  1 => 0
 * resolution:   => wontfix
 * status:  assigned => closed

Comment:

 Replying to [comment:1 Shima Fallah]:
 > I have submitted a pull request here:
 https://github.com/django/django/pull/21134
 > I've fixed the code styling issues (line length) in my branch. Ready to
 open a new PR as soon as the ticket is accepted.

 Hello Shima Fallah, thanks for the report.

 After some local testing and investigation, in my opinion the current
 error message `'one_param' received too many positional arguments` is
 sufficiently informative. A template author can reasonably diagnose the
 problem from it. The `as` keyword without a following variable name is an
 unusual mistake, and adding a special case for it would increase code
 complexity without a bigger benefit.

 Additionally, the proposed fix does not account for the case where a
 context variable named `as` is passed as an argument to a multi-parameter
 tag. Using your examples above, a context variable named `as` is valid and
 the following is a valid usage of the `div` tag:

 {{{#!django
 {% div as %}Something{% enddiv %}
 }}}

 Because of all the above, I don't think this change is warranted.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37050#comment:2>
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019dacb99012-ab519e5f-15b2-4e32-8f48-2259546ef5f5-000000%40eu-central-1.amazonses.com.

Reply via email to