Silence deprecation warnings.

Also they should only be raised if allow_syncdb does exist, not just if
allow_migrate does not.

Refs comments on 250841017c
This commit is contained in:
Marc Tamlyn 2014-02-09 17:47:40 +00:00
parent d25622000a
commit d238ab2991
1 changed files with 2 additions and 2 deletions

View File

@ -268,11 +268,11 @@ class ConnectionRouter(object):
try: try:
method = router.allow_migrate method = router.allow_migrate
except AttributeError: except AttributeError:
method = router.allow_syncdb
warnings.warn( warnings.warn(
'Router.allow_syncdb has been deprecated and will stop working in Django 1.9. ' 'Router.allow_syncdb has been deprecated and will stop working in Django 1.9. '
'Rename the method to allow_migrate.', 'Rename the method to allow_migrate.',
PendingDeprecationWarning, stacklevel=2) PendingDeprecationWarning, stacklevel=2)
method = router.allow_syncdb
except AttributeError: except AttributeError:
# If the router doesn't have a method, skip to the next one. # If the router doesn't have a method, skip to the next one.
pass pass