* status: new => closed
* ui_ux: => 0
* resolution: => needsinfo
* easy: => 0
Comment:
Code changes require more practical justification than this. Feel free to
reopen with demonstration of a specific use case, the code that is
currently required to achieve it, and the code that would be possible with
a change to Django.
--
Ticket URL: <https://code.djangoproject.com/ticket/7430#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: closed => new
* resolution: needsinfo =>
* needs_tests: 1 => 0
* stage: Design decision needed => Ready for checkin
Comment:
As per a [https://github.com/django/django/pull/16473 much later report
via a PR], `Template.__iter__()` looks broken:
{{{
>>> from django.template import Template
>>> t = Template('Hello, world!')
>>> next(iter(t))
...
TypeError: 'TextNode' object is not iterable
}}}
> I don't recall whether this was by design. Does any Django code actually
*use* this iter behavior?
According to the test suite, it doesn't.
I think this can just be removed (as per the PR).
--
Ticket URL: <https://code.djangoproject.com/ticket/7430#comment:8>
* owner: nobody => Anders Hovmöller
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/7430#comment:9>
Comment (by Anders Hovmöller):
Just FYI I have working code for walking the syntax tree:
https://github.com/boxed/okrand/blob/main/okrand/__init__.py#L262
It's... not ideal as it requires two monkey patches that I've found so
far. But I personally don't think having `__iter__` on stuff is very
useful. There are multiple child nodelists, so iter would be a little
weird honestly.
--
Ticket URL: <https://code.djangoproject.com/ticket/7430#comment:10>
Comment (by GitHub <noreply@…>):
In [changeset:"69069a443a906dd4060a8047e683657d40b4c383" 69069a4]:
{{{
#!CommitTicketReference repository=""
revision="69069a443a906dd4060a8047e683657d40b4c383"
Refs #7430 -- Removed broken Template.__iter__().
Co-authored-by: Anders Hovmöller <anders.h...@dryft.se>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/7430#comment:11>
* status: assigned => closed
* resolution: => wontfix
* stage: Ready for checkin => Unreviewed
Comment:
As per Tim's suggestion on the PR, resolving this as `wontfix`, since
directly iterating a template's nodes isn't supported.
(Short of a rationale and proof-of-concept, it doesn't seem likely to be
added.)
--
Ticket URL: <https://code.djangoproject.com/ticket/7430#comment:12>