From 9f9921e89c5c559ff4324f8cf968007cefbf6442 Mon Sep 17 00:00:00 2001 From: Grégory Starck Date: Tue, 5 Jan 2016 16:47:48 -0500 Subject: Fixed #26039 -- Unwrapped nested partials in URL reversal. Prior to Python 3.5 nested partials need to be fully "unfolded" to get the actual function. --- django/urls/resolvers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'django') diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py index 7b9db5506f..0208601f79 100644 --- a/django/urls/resolvers.py +++ b/django/urls/resolvers.py @@ -135,7 +135,9 @@ class RegexURLPattern(LocaleRegexProvider): 'path.to.ClassBasedView'). """ callback = self.callback - if isinstance(callback, functools.partial): + # Python 3.5 collapses nested partials, so can change "while" to "if" + # when it's the minimum supported version. + while isinstance(callback, functools.partial): callback = callback.func if not hasattr(callback, '__name__'): return callback.__module__ + "." + callback.__class__.__name__ -- cgit v1.3