|
@@ -913,15 +913,18 @@ class Variable:
|
|
|
try: # method call (assuming no args required)
|
|
|
current = current()
|
|
|
except TypeError:
|
|
|
- signature = inspect.signature(current)
|
|
|
try:
|
|
|
- signature.bind()
|
|
|
- except TypeError: # arguments *were* required
|
|
|
- current = (
|
|
|
- context.template.engine.string_if_invalid
|
|
|
- ) # invalid method call
|
|
|
+ signature = inspect.signature(current)
|
|
|
+ except ValueError: # No signature found.
|
|
|
+ current = context.template.engine.string_if_invalid
|
|
|
else:
|
|
|
- raise
|
|
|
+ try:
|
|
|
+ signature.bind()
|
|
|
+ except TypeError: # Arguments *were* required.
|
|
|
+ # Invalid method call.
|
|
|
+ current = context.template.engine.string_if_invalid
|
|
|
+ else:
|
|
|
+ raise
|
|
|
except Exception as e:
|
|
|
template_name = getattr(context, "template_name", None) or "unknown"
|
|
|
logger.debug(
|