From 5b3c8ce1e96d1e527ef1e088005b1eced90a61a6 Mon Sep 17 00:00:00 2001 From: Eric Huber Date: Sat, 21 Jan 2023 16:46:34 -0600 Subject: [PATCH] skipping callables found in scope to avoid builtins --- chevron/renderer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chevron/renderer.py b/chevron/renderer.py index 65a00f6..11bdc2b 100644 --- a/chevron/renderer.py +++ b/chevron/renderer.py @@ -67,7 +67,10 @@ def _get_key(key, scopes, warn, keep, def_ldel, def_rdel): scope = scope[child] except (TypeError, AttributeError): try: - scope = getattr(scope, child) + provisional_scope = getattr(scope, child) + if callable(provisional_scope): + raise TypeError('skipping callable') + scope = provisional_scope except (TypeError, AttributeError): # Try as a list scope = scope[int(child)]