#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'
 }}}

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18002#comment:1>
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 django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to