summaryrefslogtreecommitdiff
path: root/pystache/template.py
diff options
context:
space:
mode:
Diffstat (limited to 'pystache/template.py')
-rw-r--r--pystache/template.py8
1 files changed, 6 insertions, 2 deletions
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__'):