Opened 4 years ago

Closed 4 years ago

#23782 closed Uncategorized (worksforme)

Lazy objects don't support __contains__

Reported by: German M. Bravo Owned by: nobody
Component: Uncategorized Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


While trying to use SimpleLazyObject to check if something is contained in an object, the following throws an exception (AttributeError: 'int' object has no attribute 'lower') when the not in fallback to the sequence iteration protocol: 'Content-Language' not in SimpleLazyObject(lambda: HttpResponseRedirect('/'))

Attachments (1)

#23782-lazy_with_contains.diff (438 bytes) - added by German M. Bravo 4 years ago.

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by German M. Bravo

comment:1 Changed 4 years ago by Jakub Paczkowski

I see this operator in SimpleLazyObject here:
Also added a test to check if it behaves as expected:

comment:2 Changed 4 years ago by Jakub Paczkowski

Resolution: worksforme
Status: newclosed

What is more, these tests already exists in
The contains method was added to the code in this commit:

So I'm closing this issue as worksforme

Note: See TracTickets for help on using tickets.
Back to Top