wbond/pybars — pull request #4 by adambom (2014-01-27 23:39:19+00:00)
Title: Fix the way _each handles @key for dict

Prior to this patch the following template would fail when `foo` was an instance of `dict`:

```
{{#each foo}}
{{@key}}: {{this}}
{{/each}}
```

In the case where `foo = {'bar': 'baz'}` one would expect the output to be `bar: baz`, but instead the output is `bar: bar`.

The following code addresses this bug by using `iter` to get the iterable items of the collection, whether it be a `list` or a `dict`. If it's a `dict`, then `local_context` is set to be the value for the appropriate key before it's passed to the `Scope` constructor.