summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-03-22 12:29:58 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-03-22 12:29:58 -0700
commit5628daddb67c2b7086f0011cb96e593cd2079655 (patch)
treeb80679ce14d16017a15ad756d4b663c367515232
parentdcb78dd65639a3fabf70a3bc463aff013b527323 (diff)
downloadpystache-5628daddb67c2b7086f0011cb96e593cd2079655.tar.gz
Renamed Loader.template_locator to Loader.locator.
-rw-r--r--pystache/custom_template.py11
-rw-r--r--tests/test_custom_template.py6
2 files changed, 8 insertions, 9 deletions
diff --git a/pystache/custom_template.py b/pystache/custom_template.py
index dce4861..1500014 100644
--- a/pystache/custom_template.py
+++ b/pystache/custom_template.py
@@ -135,8 +135,7 @@ class Loader(object):
self.reader = reader
self.search_dirs = search_dirs
- # TODO: rename this to locator.
- self.template_locator = locator
+ self.locator = locator
# TODO: make this private.
def get_relative_template_location(self, view):
@@ -152,9 +151,9 @@ class Loader(object):
# Otherwise, we don't know the directory.
template_name = (view.template_name if view.template_name is not None else
- self.template_locator.make_template_name(view))
+ self.locator.make_template_name(view))
- file_name = self.template_locator.make_file_name(template_name, view.template_extension)
+ file_name = self.locator.make_file_name(template_name, view.template_extension)
return (template_dir, file_name)
@@ -168,9 +167,9 @@ class Loader(object):
if dir_path is None:
# Then we need to search for the path.
- path = self.template_locator.find_path_by_object(self.search_dirs, view, file_name=file_name)
+ path = self.locator.find_path_by_object(self.search_dirs, view, file_name=file_name)
else:
- obj_dir = self.template_locator.get_object_directory(view)
+ obj_dir = self.locator.get_object_directory(view)
path = os.path.join(obj_dir, dir_path, file_name)
return path
diff --git a/tests/test_custom_template.py b/tests/test_custom_template.py
index c20e410..18841bf 100644
--- a/tests/test_custom_template.py
+++ b/tests/test_custom_template.py
@@ -159,8 +159,8 @@ class LoaderTests(unittest.TestCase, AssertIsMixin):
self.assertEquals(reader.decode_errors, 'strict')
self.assertEquals(reader.encoding, sys.getdefaultencoding())
- # Check the template_locator attribute.
- locator = loader.template_locator
+ # Check the locator attribute.
+ locator = loader.locator
self.assertEquals(locator.template_extension, 'mustache')
def test_init__search_dirs(self):
@@ -179,7 +179,7 @@ class LoaderTests(unittest.TestCase, AssertIsMixin):
locator = Locator()
loader = Loader([], locator=locator)
- self.assertIs(loader.template_locator, locator)
+ self.assertIs(loader.locator, locator)
def test_get_relative_template_location(self):
"""