Re: [Django] #13085: GenericForeignKey.get_content_type fails if `object` or `id` evaluate to False. Should use 'is not None' test.

6 views
Skip to first unread message

Django

unread,
Jun 26, 2011, 8:39:13 AM6/26/11
to django-...@googlegroups.com
#13085: GenericForeignKey.get_content_type fails if `object` or `id` evaluate to
False. Should use 'is not None' test.
-------------------------------------+-------------------------------------
Reporter: | Owner: benreynwar
benreynwar | Status: new
Type: Bug | Component:
Milestone: | contrib.contenttypes
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 1 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by lrekucki):

* needs_better_patch: 0 => 1
* ui_ux: => 0
* easy: => 0


Comment:

Patch no longer cleanly applies to trunk.

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

Django

unread,
Jul 27, 2011, 1:16:19 AM7/27/11
to django-...@googlegroups.com
#13085: GenericForeignKey.get_content_type fails if `object` or `id` evaluate to
False. Should use 'is not None' test.
-------------------------------------+-------------------------------------
Reporter: | Owner:
benreynwar | Status: new
Type: Bug | Component:
Milestone: | contrib.contenttypes
Version: SVN | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 1 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by benreynwar):

* owner: benreynwar =>


--
Ticket URL: <https://code.djangoproject.com/ticket/13085#comment:8>

Django

unread,
Dec 20, 2012, 11:04:28 AM12/20/12
to django-...@googlegroups.com
#13085: GenericForeignKey.get_content_type fails if `object` or `id` evaluate to
False. Should use 'is not None' test.
--------------------------------------+------------------------------------
Reporter: benreynwar | Owner:
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by ramiro):

#14325 and #19494 were duplicates.

--
Ticket URL: <https://code.djangoproject.com/ticket/13085#comment:9>

Django

unread,
Feb 1, 2013, 9:15:32 PM2/1/13
to django-...@googlegroups.com
#13085: GenericForeignKey.get_content_type fails if `object` or `id` evaluate to
False. Should use 'is not None' test.
--------------------------------------+------------------------------------
Reporter: benreynwar | Owner:
Type: Bug | Status: new
Component: contrib.contenttypes | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by ramiro):

See also #13137.

--
Ticket URL: <https://code.djangoproject.com/ticket/13085#comment:10>

Django

unread,
Feb 7, 2013, 2:07:30 PM2/7/13
to django-...@googlegroups.com
#13085: GenericForeignKey.get_content_type fails if `object` or `id` evaluate to
False. Should use 'is not None' test.
-------------------------------------+-------------------------------------
Reporter: benreynwar | Owner: Ramiro
Type: Bug | Morales <cramm0@…>
Component: | Status: closed
contrib.contenttypes | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ramiro Morales <cramm0@…>):

* owner: => Ramiro Morales <cramm0@…>
* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"04d9730b127c689b8eda01cbc913efa6e2eb230b"]:
{{{
#!CommitTicketReference repository=""
revision="04d9730b127c689b8eda01cbc913efa6e2eb230b"
Fixed #13085 -- Don't fail on creation of model with GFK to a model with
__len__() returning zero.

Also, according to the comments on the ticket and its duplicates, added
tests execising saving an instance of a model with a GFK to:

* An unsaved object -- This actually doesn't generate the same failure
but another ORM-level exception. The test verifies it's the case.

* An instance of a model with a __nonzero__() method thant returns False
for it. This doesn't fail because that code path isn't executed.

* An instance of a model with a CharField PK and an empty value for it.
This doesn't fail.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/13085#comment:11>

Django

unread,
Apr 21, 2022, 3:59:42 AM4/21/22
to django-...@googlegroups.com
#13085: GenericForeignKey.get_content_type fails if `object` or `id` evaluate to
False. Should use 'is not None' test.
-------------------------------------+-------------------------------------
Reporter: Ben | Owner: Ramiro
| Morales <cramm0@…>
Type: Bug | Status: closed
Component: | Version: dev
contrib.contenttypes |

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by GitHub <noreply@…>):

In [changeset:"1ed8ca43f61138b8f8d6f92106c27060753ed4e7" 1ed8ca43]:
{{{
#!CommitTicketReference repository=""
revision="1ed8ca43f61138b8f8d6f92106c27060753ed4e7"
Refs #13085 -- Removed unnecessary ManyToManyFields from
generic_relations_regress test models.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/13085#comment:12>

Reply all
Reply to author
Forward
0 new messages