Re: [Django] #31582: Django template engine render pre-fetches data even when iterator() is used

2020-05-23 Thread Django
#31582: Django template engine render pre-fetches data even when iterator() is 
used
-+--
 Reporter:  Sümer Cip|Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Template system  |  Version:  3.0
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:   | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by Carlton Gibson):

 * stage:  Accepted => Unreviewed


-- 
Ticket URL: <https://code.djangoproject.com/ticket/31582#comment:12>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.b8bc3c6ba6eb1e44ae5ce64755b9487f%40djangoproject.com.


Re: [Django] #31582: Django template engine render pre-fetches data even when iterator() is used

2020-05-23 Thread Django
#31582: Django template engine render pre-fetches data even when iterator() is 
used
-+
 Reporter:  Sümer Cip|Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Template system  |  Version:  3.0
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by Carlton Gibson):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 > I certainly don't think adding another argument is a good idea, because
 you could then end up with something absurd like...

 OK. I think Keryn's analysis is correct. I agree the extra param doesn't
 look nice, but I can't see another way.

 So short of a concrete proposal, I think we have to say `wontfix`. (Happy
 to reopen if an acceptable proposal is forthcoming.)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31582#comment:11>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.9f9c129881d826595707a17f9cb7dc6e%40djangoproject.com.


Re: [Django] #31582: Django template engine render pre-fetches data even when iterator() is used

2020-05-22 Thread Django
#31582: Django template engine render pre-fetches data even when iterator() is 
used
-+
 Reporter:  Sümer Cip|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Template system  |  Version:  3.0
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+

Comment (by Keryn Knight):

 Yielding for all rendering rather than build up the `nodelist` would
 presumably assist in fixing the problem, but the problem itself would
 still have to remain as long as `revcounter` and `revcounter0` are
 documented as being there (I've no idea who'd use those, but presumably
 they exist for a reason). For `last` you can probably rework the loop to
 be based around using `next(...)` to find out if there *is* another item
 to yield, if there's not. That's last. Similarly for empty nodes rendering
 you can check whether the first `next()` raised `StopIteration`

 But until `revcounter` and `revcounter0` become optional (ie: the
 guarantee is only made if the `items` has a `__len__`) you can't avoid
 consuming the iterator to find out the overall span. I certainly don't
 think adding another argument is a good idea, because you could then end
 up with something absurd like `{% for x in mymodel.objects.all.iterator
 iterator %}` or `{% for x in mymodel.objects.all iterator %}`, right?
 which both look like typos or accidents.

 I don't know if the exception made by doing
 `reversed(mymodel.objects.all().iterator())` would get swallowed by DTL or
 surfaced, but that'd be another consideration. If it's surfaced I think
 that's fine, if it's not that's ''another'' issue.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31582#comment:10>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.2182edcb4943f2df351559af474d41a3%40djangoproject.com.


Re: [Django] #31582: Django template engine render pre-fetches data even when iterator() is used

2020-05-14 Thread Django
#31582: Django template engine render pre-fetches data even when iterator() is 
used
-+
 Reporter:  Sümer Cip|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Template system  |  Version:  3.0
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+

Comment (by Carlton Gibson):

 Ah, I didn't properly read this bit:

 > context is pointing to the item which is the model itself! Even we fix
 above len() call somehow, this will hurt us again.

 There's an effort to allow a generator based approach to template
 rendering in #13910. There's a PR for that which got so far but needs
 pushing over the line.
 I don't know if that would solve second issues here...?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31582#comment:9>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.82b713cab0f04026e86ce2bfc1a51c5b%40djangoproject.com.


Re: [Django] #31582: Django template engine render pre-fetches data even when iterator() is used

2020-05-14 Thread Django
#31582: Django template engine render pre-fetches data even when iterator() is 
used
-+
 Reporter:  Sümer Cip|Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Template system  |  Version:  3.0
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by Carlton Gibson):

 * type:  Bug => New feature
 * stage:  Unreviewed => Accepted


Comment:

 Good follow up both, that's super!

 At first glance, certainly :),  consuming the iterator into a list isn't
 ideal.


 Question is, what can we do about it?

 The next line is:

 {{{
 len_values = len(values)
 }}}

 Then `len_values` is used to populate the various loop counter variables.
 `revcounter`, `last` and so on.

 I haven't thought it through but, I could see these possibly being made
 optional, maybe along the lines of adding an extra option like `reversed`?
 (It would require editing the `do_for()` function to parse another option.
 Not sure what it should be: ...`iterator`? )

 I think we'd have to call that a new feature. The behaviour isn't
 **incorrect**, it just uses more memory than we'd like in this case.

 Let's provisionally accept on that basis. It might be worth pinging the
 DevelopersMailingList to seek advice on how to proceed, particularly with
 regard to the possible API for such a change.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31582#comment:8>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.ab1354a14c87eddece1267afc30ae0d9%40djangoproject.com.


Re: [Django] #31582: Django template engine render pre-fetches data even when iterator() is used (was: Django template backend allocates model cache even iterator() is used)

2020-05-14 Thread Django
#31582: Django template engine render pre-fetches data even when iterator() is 
used
-+--
 Reporter:  Sümer Cip|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Template system  |  Version:  3.0
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31582#comment:7>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6ab922693347aa4c11b61662ce37ae7d%40djangoproject.com.