mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
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.
This commit is contained in:
committed by
Tim Graham
parent
632a9f21bc
commit
9f9921e89c
@@ -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__
|
||||
|
||||
Reference in New Issue
Block a user