Opened 10 years ago
Closed 10 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 |
Description
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)
Change History (3)
by , 10 years ago
Attachment: | patch.diff added |
---|
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
In b81ce2e: