From: noah morrison Date: Thu, 15 Jan 2015 20:02:41 +0000 (-0500) Subject: Fixed _get_key returning prematurely X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=9d07dac312da86ea07ec2e08b7ff37f572f65456;p=chevron.git 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. ``` --- 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):