summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorGrégory Starck <gregory.starck@savoirfairelinux.com>2016-01-05 16:47:48 -0500
committerTim Graham <timograham@gmail.com>2016-01-06 15:22:37 -0500
commit9f9921e89c5c559ff4324f8cf968007cefbf6442 (patch)
treee757bae0d476e5f69f6e064b17d349c629b277f4 /django
parent632a9f21bc1212559ba7b7eb298b1128d9f004de (diff)
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.
Diffstat (limited to 'django')
-rw-r--r--django/urls/resolvers.py4
1 files changed, 3 insertions, 1 deletions
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__