diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-04-29 17:53:07 -0700 |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-04-29 17:53:07 -0700 |
commit | d95b5e9cd486616bf9d6bf4e97efcb464c4fb1d3 (patch) | |
tree | 63137c257680b17d174e7b3bc9a9426347355e2d /pystache | |
parent | 17d73cdf4d111b419607b634c15427e04825fd3b (diff) | |
download | pystache-d95b5e9cd486616bf9d6bf4e97efcb464c4fb1d3.tar.gz |
Dot notation spec tests now pass in--
https://github.com/mustache/spec/tree/9b1bc7ad19247e9671304af02078f2ce30132665
Diffstat (limited to 'pystache')
-rw-r--r-- | pystache/context.py | 10 | ||||
-rw-r--r-- | pystache/renderengine.py | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/pystache/context.py b/pystache/context.py index fe3a7d0..3cb66ba 100644 --- a/pystache/context.py +++ b/pystache/context.py @@ -189,8 +189,15 @@ class ContextStack(object): value = self.get(parts[0], _NOT_FOUND) + # The full context stack is not used to resolve the remaining parts. + # From the spec-- + # + # If any name parts were retained in step 1, each should be resolved + # against a context stack containing only the result from the former + # resolution. + # for part in parts[1:]: - # TODO: use EAFP here instead. + # TODO: consider using EAFP here instead. # http://docs.python.org/glossary.html#term-eafp if value is _NOT_FOUND: break @@ -203,6 +210,7 @@ class ContextStack(object): return value + # TODO: rename this method _get_part(). def get(self, key, default=None): """ Query the stack for the given key, and return the resulting value. diff --git a/pystache/renderengine.py b/pystache/renderengine.py index f4efd3a..918acfb 100644 --- a/pystache/renderengine.py +++ b/pystache/renderengine.py @@ -135,7 +135,7 @@ class RenderEngine(object): """ # TODO: is there a bug because we are not using the same # logic as in _get_string_value()? - data = context.get(name) + data = context.resolve(name) # Per the spec, lambdas in inverted sections are considered truthy. if data: return u'' @@ -154,7 +154,7 @@ class RenderEngine(object): """ template = template_ parsed_template = parsed_template_ - data = context.get(name) + data = context.resolve(name) # From the spec: # |