Opened 9 years ago

Closed 9 years ago

#24532 closed Bug (fixed)

AttributeError with custom routers that define allow_syncdb but not allow_migrate

Reported by: Neal Todd Owned by: nobody
Component: Database layer (models, ORM) Version: 1.8rc1
Severity: Normal Keywords: allow_migrate
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


router.allow_syncdb is deprecated and will be removed in 1.9. However, although django.db.utils.ConnectionRouter.allow_migrate() issues a warning to that effect if allow_migrate is not defined, a subsequent line inspects the arguments for router.allow_migrate causing an AttributeError.

The attached patch inspects method set in the try-except block which will be whichever of allow_syncdb or allow_migrate is defined.

If it was allow_syncdb that was defined then the code will then go on to issue the warning about the signature change to allow_migrate (allow_syncdb has the same signature as the old allow_migrate signature). Given that this warning was preceded by the warning to rename the allow_syncdb method that shouldn't cause confusion.

Attachments (1)

patch.diff (574 bytes) - added by Neal Todd 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by Neal Todd

Attachment: patch.diff added

comment:1 Changed 9 years ago by Tim Graham

Triage Stage: UnreviewedReady for checkin

comment:2 Changed 9 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In b81ce2e:

[1.8.x] Fixed #24532 -- Restored fallback support for allow_syncdb.

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