diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-03-25 16:36:24 -0700 |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-03-25 16:36:24 -0700 |
commit | 8e894975c6f467797e1e356f7758db8e0b1e5607 (patch) | |
tree | 6d5b06c827233ff438f19ca72d5cdd7b9fb4e524 | |
parent | 9f396d8765750222b9953327e7ea4f211fbc3261 (diff) | |
download | pystache-8e894975c6f467797e1e356f7758db8e0b1e5607.tar.gz |
Added support for Python 2.4: issue #89 (wangtz) and issue #94 (jvantuyl).
-rw-r--r-- | HISTORY.rst | 4 | ||||
-rw-r--r-- | README.rst | 8 | ||||
-rw-r--r-- | examples/nested_context.py | 8 | ||||
-rw-r--r-- | pystache/template.py | 8 | ||||
-rw-r--r-- | setup.py | 2 |
5 files changed, 23 insertions, 7 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index 697e52e..63c22e7 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,10 @@ History ======= +0.4.1 (2011-03-25) +------------------ +* Added support for Python 2.4. [wangtz, jvantuyl] + 0.4.0 (2011-01-12) ------------------ * Add support for nested contexts (within template and view) @@ -10,8 +10,12 @@ framework-agnostic way to render logic-free views. As ctemplates says, "It emphasizes separating logic from presentation: it is impossible to embed application logic in this template language." -Pystache is a Python implementation of Mustache. Pystache requires -Python 2.6. +Pystache is a Python implementation of Mustache. Pystache works on-- + +* Python 2.4 +* Python 2.5 +* Python 2.6 +* Python 2.7 Pystache is semantically versioned: http://semver.org. diff --git a/examples/nested_context.py b/examples/nested_context.py index 59d816a..83565a1 100644 --- a/examples/nested_context.py +++ b/examples/nested_context.py @@ -11,9 +11,11 @@ class NestedContext(pystache.View): def derp(self): return [{'inner': 'car'}] - + def herp(self): return [{'outer': 'car'}] - + def nested_context_in_view(self): - return 'it works!' if self.get('outer') == self.get('inner') else ''
\ No newline at end of file + if self.get('outer') == self.get('inner'): + return 'it works!' + return ''
\ No newline at end of file diff --git a/pystache/template.py b/pystache/template.py index 563d830..f8219cb 100644 --- a/pystache/template.py +++ b/pystache/template.py @@ -53,7 +53,11 @@ class Template(object): if kwargs: context.update(kwargs) - self.view = context if isinstance(context, View) else View(context=context) + if isinstance(context, View): + self.view = context + else: + self.view = View(context=context) + self._compile_regexps() def _compile_regexps(self): @@ -80,7 +84,7 @@ class Template(object): replacer = '' # Callable - if it and isinstance(it, collections.Callable): + if it and callable(it): replacer = it(inner) # Dictionary elif it and hasattr(it, 'keys') and hasattr(it, '__getitem__'): @@ -35,8 +35,10 @@ setup(name='pystache', "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python", + "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", ) ) |