summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-03-20 04:25:55 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-03-20 04:25:55 -0700
commitafb12bbe2203cd2de3ace5b218b27a81e4ebd40e (patch)
tree846a331fab6ac576139d0c35b92ce66ac183f8c3
parent8c2e922c0dd7ed1ca949399b672916a012e2eff0 (diff)
downloadpystache-afb12bbe2203cd2de3ace5b218b27a81e4ebd40e.tar.gz
Renamed custom_template.Locator to custom_template.Loader.
-rw-r--r--pystache/custom_template.py6
-rw-r--r--tests/test_view.py9
2 files changed, 9 insertions, 6 deletions
diff --git a/pystache/custom_template.py b/pystache/custom_template.py
index 4fd9223..40f63b9 100644
--- a/pystache/custom_template.py
+++ b/pystache/custom_template.py
@@ -16,6 +16,8 @@ from .renderer import Renderer
class CustomizedTemplate(object):
"""
+ A mixin for specifying custom template information.
+
Subclass this class only if template customizations are needed.
The following attributes allow one to customize/override template
@@ -117,10 +119,10 @@ class View(CustomizedTemplate):
return renderer.render(template, self.context)
-class Locator(object):
+class Loader(object):
"""
- A class for finding the template associated to a View instance.
+ Supports loading the template of a CustomizedTemplate instance.
"""
diff --git a/tests/test_view.py b/tests/test_view.py
index e5c8144..6f21058 100644
--- a/tests/test_view.py
+++ b/tests/test_view.py
@@ -15,7 +15,7 @@ from examples.inverted import Inverted, InvertedLists
from pystache import Renderer
from pystache import View
from pystache.reader import Reader
-from pystache.custom_template import Locator as ViewLocator
+from pystache.custom_template import Loader
from .common import AssertIsMixin
from .common import DATA_DIR
from .data.views import SampleView
@@ -132,16 +132,17 @@ class ViewTestCase(unittest.TestCase):
self.assertEquals(view.render(), """one, two, three, empty list""")
-class LocatorTests(unittest.TestCase, AssertIsMixin):
+class LoaderTests(unittest.TestCase, AssertIsMixin):
+ # TODO: rename this method to _make_loader().
def _make_locator(self):
- locator = ViewLocator(search_dirs=[DATA_DIR])
+ locator = Loader(search_dirs=[DATA_DIR])
return locator
# TODO: fully test constructor.
def test_init__reader(self):
reader = "reader" # in practice, this is a reader instance.
- locator = ViewLocator(search_dirs=None, template_locator=None, reader=reader)
+ locator = Loader(search_dirs=None, template_locator=None, reader=reader)
self.assertIs(locator.reader, reader)