Opened 11 years ago
Closed 11 years ago
#20924 closed Bug (fixed)
LazyObject missing __contains__ and __len__ proxy
Reported by: | nickbruun | Owned by: | nobody |
---|---|---|---|
Component: | Utilities | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
django.utils.functionals.LazyObject
does not proxy the __contains__
and __len__
data methods. This means that the following use cases for lazy objects that return lists, sets or dicts are not possible:
key in lazy_object len(lazy_object)
Fixing this is trivial as has been shown by the current proxying implementation of __getitem__
, __setitem__
and __delitem__
. Regression test and patch is available on Github at https://github.com/nickbruun/django.
Change History (6)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Please untick "Patch needs improvement" when you can update the PR per the comment, thanks!
comment:3 by , 11 years ago
Patch needs improvement: | unset |
---|
comment:4 by , 11 years ago
Patch needs improvement: | set |
---|
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The specific URL for the branch is https://github.com/nickbruun/django/tree/ticket_20924 and the pull request is at https://github.com/django/django/pull/1479.