summaryrefslogtreecommitdiff
path: root/django/db/utils.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-06-10 17:24:04 -0400
committerTim Graham <timograham@gmail.com>2015-10-25 06:02:21 -0400
commite2ea30c4403fca1b0a2032aae7a783f8705fc08b (patch)
tree3f4f39f8422db192425cdde82d1af1344df5fc22 /django/db/utils.py
parent84ec3bfc1111525ee0b21afff870840b2eb13771 (diff)
[1.8.x] Fixed #24979 -- Removed usage of inspect.getargspec().
Backport of 3872a33132a4bb6aa22b237927597bbfdf6f21d7 from master
Diffstat (limited to 'django/db/utils.py')
-rw-r--r--django/db/utils.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/django/db/utils.py b/django/db/utils.py
index 2261a69f71..47dd5fd937 100644
--- a/django/db/utils.py
+++ b/django/db/utils.py
@@ -333,8 +333,16 @@ class ConnectionRouter(object):
# If the router doesn't have a method, skip to the next one.
continue
- argspec = inspect.getargspec(method)
- if len(argspec.args) == 3 and not argspec.keywords:
+ if six.PY3:
+ sig = inspect.signature(router.allow_migrate)
+ has_deprecated_signature = not any(
+ p.kind == inspect.Parameter.VAR_KEYWORD for p in sig.parameters.values()
+ )
+ else:
+ argspec = inspect.getargspec(router.allow_migrate)
+ has_deprecated_signature = len(argspec.args) == 3 and not argspec.keywords
+
+ if has_deprecated_signature:
warnings.warn(
"The signature of allow_migrate has changed from "
"allow_migrate(self, db, model) to "