Commit 1542217e by Chris Jerdonek

Renamed CustomizedTemplate to TemplateSpec.

parent ce5cc974
...@@ -6,11 +6,11 @@ This module contains the initialization logic called by __init__.py. ...@@ -6,11 +6,11 @@ This module contains the initialization logic called by __init__.py.
""" """
from .template_spec import View from .template_spec import View
from .template_spec import CustomizedTemplate from .template_spec import TemplateSpec
from .renderer import Renderer from .renderer import Renderer
__all__ = ['render', 'Renderer', 'View', 'CustomizedTemplate'] __all__ = ['render', 'Renderer', 'View', 'TemplateSpec']
def render(template, context=None, **kwargs): def render(template, context=None, **kwargs):
......
...@@ -13,8 +13,7 @@ from .locator import Locator ...@@ -13,8 +13,7 @@ from .locator import Locator
from .renderer import Renderer from .renderer import Renderer
# TODO: consider renaming this to something like Template or TemplateInfo. class TemplateSpec(object):
class CustomizedTemplate(object):
""" """
A mixin for specifying custom template information. A mixin for specifying custom template information.
...@@ -52,7 +51,7 @@ class CustomizedTemplate(object): ...@@ -52,7 +51,7 @@ class CustomizedTemplate(object):
# TODO: remove this class. # TODO: remove this class.
class View(CustomizedTemplate): class View(TemplateSpec):
_renderer = None _renderer = None
...@@ -185,13 +184,13 @@ class CustomLoader(object): ...@@ -185,13 +184,13 @@ class CustomLoader(object):
def load(self, custom): def load(self, custom):
""" """
Find and return the template associated to a CustomizedTemplate instance. Find and return the template associated to a TemplateSpec instance.
Returns the template as a unicode string. Returns the template as a unicode string.
Arguments: Arguments:
custom: a CustomizedTemplate instance. custom: a TemplateSpec instance.
""" """
if custom.template is not None: if custom.template is not None:
......
# coding: utf-8 # coding: utf-8
from pystache import CustomizedTemplate from pystache import TemplateSpec
class SayHello(object): class SayHello(object):
...@@ -8,9 +8,9 @@ class SayHello(object): ...@@ -8,9 +8,9 @@ class SayHello(object):
return "World" return "World"
class SampleView(CustomizedTemplate): class SampleView(TemplateSpec):
pass pass
class NonAscii(CustomizedTemplate): class NonAscii(TemplateSpec):
pass pass
...@@ -13,7 +13,7 @@ from examples.simple import Simple ...@@ -13,7 +13,7 @@ from examples.simple import Simple
from examples.complex_view import ComplexView from examples.complex_view import ComplexView
from examples.lambdas import Lambdas from examples.lambdas import Lambdas
from examples.inverted import Inverted, InvertedLists from examples.inverted import Inverted, InvertedLists
from pystache import CustomizedTemplate as Template from pystache import TemplateSpec as Template
from pystache import Renderer from pystache import Renderer
from pystache import View from pystache import View
from pystache.template_spec import CustomLoader from pystache.template_spec import CustomLoader
...@@ -255,8 +255,8 @@ class CustomLoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin): ...@@ -255,8 +255,8 @@ class CustomLoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
# TODO: rename the get_template() tests to test load(). # TODO: rename the get_template() tests to test load().
# TODO: condense, reorganize, and rename the tests so that it is # TODO: condense, reorganize, and rename the tests so that it is
# clear whether we have full test coverage (e.g. organized by # clear whether we have full test coverage (e.g. organized by
# CustomizedTemplate attributes or something). # TemplateSpec attributes or something).
class CustomizedTemplateTests(unittest.TestCase): class TemplateSpecTests(unittest.TestCase):
# TODO: rename this method to _make_loader(). # TODO: rename this method to _make_loader().
def _make_locator(self): def _make_locator(self):
......
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