summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-03-28 21:09:57 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-03-28 21:09:57 -0700
commita06fd4233d55ea317ea03b81c98b149e3d5b1364 (patch)
tree3318cc8cf91b475c69ee265a86d6fe172fbb940c
parent652b6ccc311fd5c5682e9889cec852a755f88819 (diff)
parentc189bb2e953e93501e09131eb9736d03010cb58c (diff)
downloadpystache-0.4.1.tar.gz
Merge branch 'hotfix-v0.4.1' into master (issue #97)v0.4.1
v0.4.1 should now be ready to push to PyPI.
-rw-r--r--HISTORY.rst4
-rw-r--r--README.rst15
-rw-r--r--examples/nested_context.py8
-rw-r--r--pystache/template.py8
-rw-r--r--setup.py4
5 files changed, 30 insertions, 9 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 697e52e..6e8f1a1 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,10 @@
History
=======
+0.4.1 (2012-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)
diff --git a/README.rst b/README.rst
index 7642a47..46b436d 100644
--- a/README.rst
+++ b/README.rst
@@ -10,12 +10,16 @@ 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.
-Logo: David Phillips - http://davidphillips.us/
+Logo: David Phillips - http://davidphillips.us/
Documentation
=============
@@ -67,6 +71,11 @@ nose_ works great! ::
cd pystache
nosetests
+Depending on your Python version and nose installation, you may need
+to type, for example ::
+
+ nosetests-2.4
+
Mailing List
==================
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__'):
diff --git a/setup.py b/setup.py
index 5ec959b..d625922 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ if sys.argv[-1] == "publish":
sys.exit()
setup(name='pystache',
- version='0.4.0',
+ version='0.4.1',
description='Mustache for Python',
long_description=open('README.rst').read() + '\n\n' + open('HISTORY.rst').read(),
author='Chris Wanstrath',
@@ -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",
)
)