Opened 7 years ago

Closed 7 years ago

#17898 closed Bug (fixed)

The database option is not honored when `createsuperuser` is called by `syncdb`

Reported by: Simon Charette Owned by: nobody
Component: contrib.auth Version: 1.3
Severity: Release blocker Keywords: syncdb createsuperuser database multidb
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


When calling the syncdb command with a database kwarg

./ syncdb --database my_specific_db

The post_sync_db signal is dispatched correctly but the receiver doesn't take the db kwarg into account when calling createsuperuser thus it attempts to create it on the default database. It should call the command on the database specified in syncdb.

I'm attaching a patch but I really don't know where I should add tests for this, I can't find where syncdb is tested. Is it??

Attachments (1)

syncdb-multidb-createsuperuser.diff (1021 bytes) - added by Simon Charette 7 years ago.

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by Simon Charette

comment:1 Changed 7 years ago by Julien Phalip

Needs tests: set
Severity: NormalRelease blocker

I haven't verified the issue yet, but this could potentially be a bug in a new feature (added in [17665]), therefore marking as release blocker.

Last edited 7 years ago by Julien Phalip (previous) (diff)

comment:2 Changed 7 years ago by Simon Charette

I can confirm r17665 introduced the regression.

Everything worked just fine before this changeset since I was using a router to specify the User's db_for_(write|read). Now that using(database) is explicitly called in the createsuperuser command it's not asking the router anymore therefore triggering this issue.

comment:3 Changed 7 years ago by James Bennett

Resolution: fixed
Status: newclosed

In [17738]:

Fixed #17898: Ensure create_superuser honors the 'db' argument from post_sync_db. Thanks to charettes for the patch.

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