[Django] #20924: LazyObject missing __contains__ and __len__ proxy

4 views
Skip to first unread message

Django

unread,
Aug 15, 2013, 2:56:31 PM8/15/13
to django-...@googlegroups.com
#20924: LazyObject missing __contains__ and __len__ proxy
----------------------------+--------------------
Reporter: nickbruun | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 1 | UI/UX: 0
----------------------------+--------------------
`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.

--
Ticket URL: <https://code.djangoproject.com/ticket/20924>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 15, 2013, 3:02:21 PM8/15/13
to django-...@googlegroups.com
#20924: LazyObject missing __contains__ and __len__ proxy
---------------------------+--------------------------------------

Reporter: nickbruun | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
---------------------------+--------------------------------------
Changes (by nickbruun):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/20924#comment:1>

Django

unread,
Aug 16, 2013, 3:27:10 PM8/16/13
to django-...@googlegroups.com
#20924: LazyObject missing __contains__ and __len__ proxy
---------------------------+------------------------------------

Reporter: nickbruun | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
---------------------------+------------------------------------
Changes (by timo):

* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Please untick "Patch needs improvement" when you can update the PR per the
comment, thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/20924#comment:2>

Django

unread,
Aug 18, 2013, 9:55:37 AM8/18/13
to django-...@googlegroups.com
#20924: LazyObject missing __contains__ and __len__ proxy
---------------------------+------------------------------------

Reporter: nickbruun | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
---------------------------+------------------------------------
Changes (by nickbruun):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/20924#comment:3>

Django

unread,
Aug 18, 2013, 9:56:03 AM8/18/13
to django-...@googlegroups.com
#20924: LazyObject missing __contains__ and __len__ proxy
---------------------------+------------------------------------

Reporter: nickbruun | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
---------------------------+------------------------------------
Changes (by nickbruun):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/20924#comment:4>

Django

unread,
Aug 18, 2013, 9:59:20 AM8/18/13
to django-...@googlegroups.com
#20924: LazyObject missing __contains__ and __len__ proxy
---------------------------+------------------------------------

Reporter: nickbruun | Owner: nobody
Type: Bug | Status: new
Component: Utilities | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
---------------------------+------------------------------------
Changes (by nickbruun):

* needs_better_patch: 1 => 0


Comment:

Patch updated.

--
Ticket URL: <https://code.djangoproject.com/ticket/20924#comment:5>

Django

unread,
Aug 18, 2013, 12:45:43 PM8/18/13
to django-...@googlegroups.com
#20924: LazyObject missing __contains__ and __len__ proxy
---------------------------+------------------------------------
Reporter: nickbruun | Owner: nobody
Type: Bug | Status: closed
Component: Utilities | Version: 1.5
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
---------------------------+------------------------------------
Changes (by anonymous):

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


Comment:

Fixed by aa01c99f5587b36c354e80c682ad52e1a3b41455

--
Ticket URL: <https://code.djangoproject.com/ticket/20924#comment:6>

Reply all
Reply to author
Forward
0 new messages