From 9d07dac312da86ea07ec2e08b7ff37f572f65456 Mon Sep 17 00:00:00 2001 From: noah morrison Date: Thu, 15 Jan 2015 15:02:41 -0500 Subject: [PATCH] Fixed _get_key returning prematurely Variables were clobbering other variables... badness was happening. When given ```test.ms {{# container }} {{ sibbling.child }} {{/ container }} ``` ```test.json { "container": [1,2,3], "sibbling": { "child": "Just me." } } ``` it was returning ```wrong.txt {'child': 'Just me.'} {'child': 'Just me.'} {'child': 'Just me.'} ``` when it should have returned ```right.txt Just me. Just me. Just me. ``` --- chevron/renderer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chevron/renderer.py b/chevron/renderer.py index de23cbf..ac2da27 100644 --- a/chevron/renderer.py +++ b/chevron/renderer.py @@ -53,9 +53,9 @@ def _get_key(key, scopes): for scope in scopes: try: # For every dot seperated key - for key in key.split('.'): + for child in key.split('.'): # Move into the scope - scope = scope[key] + scope = scope[child] # Return the last scope we got return scope except (TypeError, KeyError): -- 2.47.3