Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#12999 closed (fixed)

update_all_contenttypes in contenttypes.management fails in django 1.2

Reported by: lsbardel Owned by: nobody
Component: Contrib apps Version: dev
Severity: Keywords: contenttypes
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Bug introduced with multiple database support. The function loop over installed applications and call update_contenttypes without passing a keyworded "db" argument.
update_contenttypes fails when no "db" is available. To fix the problem I replaced

db = kwargs["db"]

with

db = kwargs.get('db',None)

Attachments (2)

management.diff (545 bytes ) - added by lsbardel 14 years ago.
management_no_using.diff (1.5 KB ) - added by lsbardel 14 years ago.

Download all attachments as: .zip

Change History (8)

by lsbardel, 14 years ago

Attachment: management.diff added

comment:1 by lsbardel, 14 years ago

milestone: 1.2

comment:2 by Russell Keith-Magee, 14 years ago

milestone: 1.2
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

To be clear, the issue is specifically with the update_all_contenttypes() call. This highlights that there are a couple of problems with the current implementation; there shouldn't be the need for calls to using in update_contenttypes().

by lsbardel, 14 years ago

Attachment: management_no_using.diff added

comment:3 by lsbardel, 14 years ago

Removed "using" in update_contenttypes. This way ContentType objects will be saved in the default database or the one specified in the routing scheme.

comment:4 by Gabriel Hurley, 14 years ago

Component: UncategorizedContrib apps

comment:5 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

(In [12750]) Fixed #12999 -- Modified the contenttypes syncdb handler to use db router logic. Thanks to lsbardel for the report.

comment:6 by Jacob, 12 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top