1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #29400 -- Fixed crash in custom template filters that use decorated functions.

Regression in 620e9dd31a.
This commit is contained in:
Ryan Rubin
2018-05-25 10:11:46 -05:00
committed by Tim Graham
parent 96ea4f875b
commit a8d12bc280
5 changed files with 18 additions and 3 deletions

View File

@@ -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)