Commit 77f508bc by Chris Jerdonek

Merge pull request #29 (1) "code in __init__.py is evil"

From: https://github.com/kennethreitz/pystache/commit/8ca7408f6948f7a7214897d4a31b0a3aabaf8216
Into: issue_29

Moves code out of __init__.py into its own module.

Changes from the original request:

 * Called the new module init.py instead of core.py.
 * Added a comment inside __init__.py.
 * Used editor-agnostic encoding line.
 * Fixed import line in view.py since nosetests was breaking.
parents d2eab0f5 8ca7408f
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 *
# 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()
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
......
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