#18979: PermWrapper + template "if in" interaction
---------------------------------+------------------------------------
     Reporter:  akaariai         |                    Owner:  akaariai
         Type:  Bug              |                   Status:  new
    Component:  Template system  |                  Version:  1.4
     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 akaariai):

 * owner:  nobody => akaariai
 * stage:  Unreviewed => Accepted


Comment:

 An irc-discussion with Alex, and the reason for this is now clear. The
 reason is that if there isn't `__iter__` defined for an object, but it has
 a `__getitem__` which never raises !IndexError, then the 'something' in
 obj will continuously check for obj[i] == 'something'; i++...

 The solution is to define an `__iter__` which raises !TypeError.

 I am assigning this to myself. The only question is how to test this... A
 possible test would be to check False not in perms - the reason is that
 `__getitem__` will return False for the first index, 0, and then the in
 check will see False in the perms incorrectly. And, there should be no
 possibility of forever-loop.

 I am going to backpatch this to 1.4, too.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18979#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 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