#36998: firstof tag doesn't require an argument when used with as var
----------------------+-------------------------------------------
     Reporter:  Lily  |                     Type:  Bug
       Status:  new   |                Component:  Template system
      Version:  6.0   |                 Severity:  Normal
     Keywords:        |             Triage Stage:  Unreviewed
    Has patch:  0     |      Needs documentation:  0
  Needs tests:  0     |  Patch needs improvement:  0
Easy pickings:  1     |                    UI/UX:  0
----------------------+-------------------------------------------
 The `{% firstof %}` template tag raises a `TemplateSyntaxError("'firstof'
 statement requires at least one argument")` when called with no arguments.

 However, when called with exactly two arguments that match the variable
 capturing syntax (e.g. `{% firstof as foo %}`) no error is raised and the
 `FirstOfNode` is returned with an empty `vars` list (and an `asvar` of
 e.g. `foo`). It would be consistent to raise a
 `TemplateSyntaxError("'firstof' statement requires at least one argument
 before 'as'")` here.

 This was discovered when [https://github.com/LilyFirefly/django-rusty-
 templates/pull/366/changes#r2971319569 re-implementing `firstof` in
 django-rusty-templates].
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36998>
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/0107019d1506134d-315b6ed8-5b61-44fe-9772-b964affd96e9-000000%40eu-central-1.amazonses.com.

Reply via email to