summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pystache/__init__.py10
-rw-r--r--pystache/init.py15
-rw-r--r--pystache/view.py4
3 files changed, 20 insertions, 9 deletions
diff --git a/pystache/__init__.py b/pystache/__init__.py
index 314c5c8..daf7f52 100644
--- a/pystache/__init__.py
+++ b/pystache/__init__.py
@@ -1,8 +1,2 @@
-from pystache.template import Template
-from pystache.view import View
-from pystache.loader import Loader
-
-def render(template, context=None, **kwargs):
- context = context and context.copy() or {}
- context.update(kwargs)
- return Template(template, context).render()
+# We keep all initialization code in a separate module.
+from init import *
diff --git a/pystache/init.py b/pystache/init.py
new file mode 100644
index 0000000..4544974
--- /dev/null
+++ b/pystache/init.py
@@ -0,0 +1,15 @@
+# encoding: utf-8
+
+from .template import Template
+from .view import View
+from .loader import Loader
+
+__all__ = ['Template', 'View', 'Loader', 'render']
+
+
+def render(template, context=None, **kwargs):
+
+ context = context and context.copy() or {}
+ context.update(kwargs)
+
+ return Template(template, context).render()
diff --git a/pystache/view.py b/pystache/view.py
index 68cb9b6..2352b40 100644
--- a/pystache/view.py
+++ b/pystache/view.py
@@ -1,8 +1,10 @@
-from pystache import Template
import os.path
import re
from types import *
+from .template import Template
+
+
def get_or_attr(context_list, name, default=None):
if not context_list:
return default