#19261: Page.__getitem__ usage causes queryset to evaluate when doing method
lookups
-------------------------------------+-------------------------------------
     Reporter:  trbs                 |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |                  Version:  1.4
    Component:  Template system      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  page, type_error,    |      Needs documentation:  0
  __getitem__, pagination            |  Patch needs improvement:  0
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  1                    |
Easy pickings:  1                    |
-------------------------------------+-------------------------------------
Changes (by claudep):

 * needs_tests:  0 => 1


Comment:

 Replying to [comment:2 trbs]:
 > So are you suggestion that the 'proper' fix would be that the template
 system should not do slicing operation when a function which the same
 exists on the object ?

 No, I think your approach is fine. You can see something similar in
 `QuerySet.__getitem__`. It might even be better to copy the exact same two
 lines (`if not isinstance(k, (slice,) + six.integer_types): raise
 TypeError`). Then we need tests, of course.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19261#comment:3>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to