From 6702d5e35c85a3ea39a073187882ddc4fde6f10d Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Tue, 23 Oct 2018 08:19:02 -0600 Subject: [PATCH] PR feedback --- dbt/clients/jinja.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dbt/clients/jinja.py b/dbt/clients/jinja.py index 4d79b72ba87..db15ae87d98 100644 --- a/dbt/clients/jinja.py +++ b/dbt/clients/jinja.py @@ -185,6 +185,10 @@ def parse(self, parser): return node +def _is_dunder_name(name): + return name.startswith('__') and name.endswith('__') + + def create_macro_capture_env(node): class ParserMacroCapture(jinja2.Undefined): @@ -220,7 +224,7 @@ def __deepcopy__(self, memo): ) def __getattr__(self, name): - if name == 'name' or name.startswith('__') and name.endswith('__'): + if name == 'name' or _is_dunder_name(name): raise AttributeError( "'{}' object has no attribute '{}'" .format(type(self).__name__, name)