Django

Code

Ticket #12999 (closed: fixed)

Opened 5 months ago

Last modified 5 months ago

update_all_contenttypes in contenttypes.management fails in django 1.2

Reported by: lsbardel Assigned to: nobody
Milestone: 1.2 Component: Contrib apps
Version: SVN Keywords: contenttypes
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

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

management.diff (0.5 kB) - added by lsbardel on 03/01/10 03:42:32.
management_no_using.diff (1.5 kB) - added by lsbardel on 03/01/10 06:09:07.

Change History

03/01/10 03:42:32 changed by lsbardel

  • attachment management.diff added.

03/01/10 03:52:49 changed by lsbardel

  • needs_better_patch changed.
  • needs_docs changed.
  • needs_tests changed.
  • milestone deleted.

03/01/10 04:33:35 changed by russellm

  • needs_better_patch set to 1.
  • stage changed from Unreviewed to Accepted.
  • milestone set to 1.2.

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().

03/01/10 06:09:07 changed by lsbardel

  • attachment management_no_using.diff added.

03/01/10 06:14:45 changed by lsbardel

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

03/02/10 15:33:21 changed by gabrielhurley

  • component changed from Uncategorized to Contrib apps.

03/10/10 06:34:49 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #12999 (update_all_contenttypes in contenttypes.management fails in django 1.2)




Change Properties
Action