Commit 5e93199f by Chris Jerdonek

Merge pull request #14 (1) "Python compatibility" from rhettg/pystache

Merge commit '1e72b7a4' into development
All 56 tests now pass while using Python 2.5.6.

Conflicts:
	pystache/template.py
parents 7ccb55fd 1e72b7a4
......@@ -14,6 +14,15 @@ except ImportError:
literal = unicode
try:
import collections.Callable
def check_callable(it):
return isinstance(it, collections.Callable)
except ImportError:
def check_callable(it):
return hasattr(it, '__call__')
class Modifiers(dict):
"""Dictionary with a decorator for assigning functions to keys."""
......@@ -80,7 +89,7 @@ class Template(object):
replacer = ''
# Callable
if it and isinstance(it, collections.Callable):
if it and check_callable(it):
replacer = it(inner)
# Dictionary
elif it and hasattr(it, 'keys') and hasattr(it, '__getitem__'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment