[Django] #18002: Typo in ReverseSingleRelatedObjectDescriptor

10 views
Skip to first unread message

Django

unread,
Mar 29, 2012, 1:59:30 AM3/29/12
to django-...@googlegroups.com
#18002: Typo in ReverseSingleRelatedObjectDescriptor
-------------------------------------------------+--------------------
Reporter: Bradley Ayers <bradley.ayers@…> | Owner: nobody
Type: Uncategorized | Status: new
Component: Database layer (models, ORM) | Version: 1.4
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------------------+--------------------
This code uses ``_field`` instead of ``field``:

{{{
def __set__(self, instance, value):
if instance is None:
raise AttributeError("%s must be accessed via instance" %
self._field.name)
}}}

Example:

{{{
>>> from django.contrib.auth.models import Permission
>>> Permission.content_type.__set__(None, "foo")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/brad/work/awu/.env/lib/python2.7/site-
packages/django/db/models/fields/related.py", line 356, in __set__
raise AttributeError("%s must be accessed via instance" %
self._field.name)
AttributeError: 'ReverseSingleRelatedObjectDescriptor' object has no
attribute '_field'
}}}

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

Django

unread,
Mar 29, 2012, 2:05:20 AM3/29/12
to django-...@googlegroups.com
#18002: Typo in ReverseSingleRelatedObjectDescriptor
-------------------------------------+-------------------------------------
Reporter: Bradley Ayers | Owner: nobody
<bradley.ayers@…> | Status: new
Type: Uncategorized | Version: 1.4
Component: Database layer | Resolution:
(models, ORM) | Triage Stage:
Severity: Normal | Unreviewed
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

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


Old description:


> This code uses ``_field`` instead of ``field``:
>
> {{{
> def __set__(self, instance, value):
> if instance is None:
> raise AttributeError("%s must be accessed via instance" %
> self._field.name)
> }}}
>
> Example:
>
> {{{
> >>> from django.contrib.auth.models import Permission
> >>> Permission.content_type.__set__(None, "foo")
> Traceback (most recent call last):
> File "<console>", line 1, in <module>
> File "/Users/brad/work/awu/.env/lib/python2.7/site-
> packages/django/db/models/fields/related.py", line 356, in __set__
> raise AttributeError("%s must be accessed via instance" %
> self._field.name)
> AttributeError: 'ReverseSingleRelatedObjectDescriptor' object has no
> attribute '_field'
> }}}

New description:


This code uses ``_field`` instead of ``field``:

{{{
def __set__(self, instance, value):
if instance is None:
raise AttributeError("%s must be accessed via instance" %
self._field.name)
}}}

Example:

{{{
>>> from django.contrib.auth.models import Permission
>>> Permission.content_type.__set__(None, "foo")
Traceback (most recent call last):
File "<console>", line 1, in <module>

File "/Users/brad/work/foo/.env/lib/python2.7/site-

packages/django/db/models/fields/related.py", line 356, in __set__
raise AttributeError("%s must be accessed via instance" %
self._field.name)
AttributeError: 'ReverseSingleRelatedObjectDescriptor' object has no
attribute '_field'
}}}

--

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

Django

unread,
Mar 29, 2012, 2:05:47 AM3/29/12
to django-...@googlegroups.com
#18002: Typo in ReverseSingleRelatedObjectDescriptor
-------------------------------------+-------------------------------------
Reporter: Bradley Ayers | Owner: nobody
<bradley.ayers@…> | Status: new
Type: Uncategorized | Version: 1.4
Component: Database layer | Resolution:
(models, ORM) | Triage Stage:
Severity: Normal | Unreviewed
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

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


Old description:


> This code uses ``_field`` instead of ``field``:
>
> {{{
> def __set__(self, instance, value):
> if instance is None:
> raise AttributeError("%s must be accessed via instance" %
> self._field.name)
> }}}
>
> Example:
>
> {{{
> >>> from django.contrib.auth.models import Permission
> >>> Permission.content_type.__set__(None, "foo")
> Traceback (most recent call last):
> File "<console>", line 1, in <module>
> File "/Users/brad/work/awu/.env/lib/python2.7/site-
> packages/django/db/models/fields/related.py", line 356, in __set__
> raise AttributeError("%s must be accessed via instance" %
> self._field.name)
> AttributeError: 'ReverseSingleRelatedObjectDescriptor' object has no
> attribute '_field'
> }}}

New description:


This code uses ``_field`` instead of ``field``:

{{{
def __set__(self, instance, value):
if instance is None:
raise AttributeError("%s must be accessed via instance" %
self._field.name)
}}}

Example:

{{{
>>> from django.contrib.auth.models import Permission
>>> Permission.content_type.__set__(None, "foo")
Traceback (most recent call last):
File "<console>", line 1, in <module>

File "/Users/brad/work/foo/.env/lib/python2.7/site-

packages/django/db/models/fields/related.py", line 356, in __set__
raise AttributeError("%s must be accessed via instance" %
self._field.name)
AttributeError: 'ReverseSingleRelatedObjectDescriptor' object has no
attribute '_field'
}}}

--

--

Django

unread,
Apr 2, 2012, 1:47:49 AM4/2/12
to django-...@googlegroups.com
#18002: Typo in ReverseSingleRelatedObjectDescriptor
-------------------------------------+-------------------------------------
Reporter: Bradley Ayers | Owner: nobody
<bradley.ayers@…> | Status: new
Type: Uncategorized | Version: 1.4
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Ready for
Severity: Normal | checkin
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by ptone):

* has_patch: 0 => 1
* stage: Unreviewed => Ready for checkin


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

Django

unread,
Apr 2, 2012, 3:37:59 AM4/2/12
to django-...@googlegroups.com
#18002: Typo in ReverseSingleRelatedObjectDescriptor
-------------------------------------+-------------------------------------
Reporter: Bradley Ayers | Owner: nobody
<bradley.ayers@…> | Status: new
Type: Bug | Version: 1.4
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 1 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by claudep):

* type: Uncategorized => Bug
* needs_tests: 0 => 1
* stage: Ready for checkin => Accepted


Comment:

What about a test?

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

Django

unread,
Apr 12, 2012, 4:23:42 PM4/12/12
to django-...@googlegroups.com
#18002: Typo in ReverseSingleRelatedObjectDescriptor
-------------------------------------+-------------------------------------
Reporter: Bradley Ayers | Owner: nobody
<bradley.ayers@…> | Status: closed
Type: Bug | Version: 1.4
Component: Database layer | Resolution: fixed
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 1 |
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by claudep):

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


Comment:

In [17904]:
{{{
#!CommitTicketReference repository="" revision="17904"
Fixed #18002 -- Fixed typo in attribute name in
ReverseSingleRelatedObjectDescriptor.
}}}

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

Reply all
Reply to author
Forward
0 new messages