diff options
| author | Ryan Rubin <ryanmrubin@gmail.com> | 2018-05-25 10:11:46 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-05-25 11:12:03 -0400 |
| commit | 6b91152a103f7c5cbefcf44741e6b03611724714 (patch) | |
| tree | 79114dff2ab4fcd1d007f522c6bad0dcd29f6b58 /django | |
| parent | 3cca2ab2e7d32eea46ad615b18f7ac1812dbd85b (diff) | |
[2.1.x] Fixed #29400 -- Fixed crash in custom template filters that use decorated functions.
Regression in 620e9dd31a2146d70de740f96a8cb9a6db054fc7.
Backport of a8d12bc28069d56e0306770ab9c73738293663f7 from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/template/base.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/template/base.py b/django/template/base.py index 9dafd3eb59..c2376ff5a5 100644 --- a/django/template/base.py +++ b/django/template/base.py @@ -53,7 +53,7 @@ times with multiple contexts) import logging import re from enum import Enum -from inspect import getcallargs, getfullargspec +from inspect import getcallargs, getfullargspec, unwrap from django.template.context import ( # NOQA: imported for backwards compatibility BaseContext, Context, ContextPopException, RequestContext, @@ -707,7 +707,7 @@ class FilterExpression: # First argument, filter input, is implied. plen = len(provided) + 1 # Check to see if a decorator is providing the real function. - func = getattr(func, '_decorated_function', func) + func = unwrap(func) args, _, _, defaults, _, _, _ = getfullargspec(func) alen = len(args) |
