Skip to content

Commit

Permalink
implement getitem so jinja cleanly propagates undefined values during…
Browse files Browse the repository at this point in the history
… parsing
  • Loading branch information
Jacob Beck committed Oct 23, 2018
1 parent 15ae37a commit 045783e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dbt/clients/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ def __deepcopy__(self, memo):
.format(self.node.get('package_name'), self.node.get('name'))
)

def __getitem__(self, name):
# Propagate the undefined value if a caller accesses this as if it
# were a dictionary
return self

def __getattr__(self, name):
if name == 'name' or _is_dunder_name(name):
raise AttributeError(
Expand Down

0 comments on commit 045783e

Please sign in to comment.