diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-04-01 11:55:16 -0700 |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-04-01 11:55:16 -0700 |
commit | 51e31f57d870ae0d0b7892c9ecebb9626fbb1b3c (patch) | |
tree | 518dcf4d28d05e52df5999f81e5da2c007e4e816 | |
parent | 81c6a9c44e58c6ea5e4cea671be09cdd145119ee (diff) | |
download | pystache-51e31f57d870ae0d0b7892c9ecebb9626fbb1b3c.tar.gz |
Removed search_dirs from the SpecLoader constructor.
-rw-r--r-- | pystache/template_spec.py | 12 | ||||
-rw-r--r-- | tests/test_template_spec.py | 15 |
2 files changed, 7 insertions, 20 deletions
diff --git a/pystache/template_spec.py b/pystache/template_spec.py index 83aebfd..ff4979b 100644 --- a/pystache/template_spec.py +++ b/pystache/template_spec.py @@ -122,8 +122,8 @@ class View(TemplateSpec): return renderer.render(template, self.context) -# TODO: get this class fully working with test cases, and then refactor -# and replace the View class. +# TODO: add test cases for this class, and then refactor while replacing the +# View class. class SpecLoader(object): """ @@ -131,15 +131,11 @@ class SpecLoader(object): """ - def __init__(self, search_dirs=None, loader=None): + def __init__(self, loader=None): if loader is None: loader = Loader() - if search_dirs is None: - search_dirs = [] - self.loader = loader - self.search_dirs = search_dirs def _find_relative(self, spec): """ @@ -175,7 +171,7 @@ class SpecLoader(object): if dir_path is None: # Then we need to search for the path. - path = locator.find_object(spec, self.search_dirs, file_name=file_name) + path = locator.find_object(spec, self.loader.search_dirs, file_name=file_name) else: obj_dir = locator.get_object_directory(spec) path = os.path.join(obj_dir, dir_path, file_name) diff --git a/tests/test_template_spec.py b/tests/test_template_spec.py index 13fd4e6..b3d7093 100644 --- a/tests/test_template_spec.py +++ b/tests/test_template_spec.py @@ -150,20 +150,12 @@ class SpecLoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin): loader = custom.loader self.assertEquals(loader.extension, 'mustache') self.assertEquals(loader.file_encoding, sys.getdefaultencoding()) + # TODO: finish testing the other Loader attributes. to_unicode = loader.to_unicode - # Check search_dirs. - self.assertEquals(custom.search_dirs, []) - - def test_init__search_dirs(self): - search_dirs = ['a', 'b'] - loader = SpecLoader(search_dirs) - - self.assertEquals(loader.search_dirs, ['a', 'b']) - def test_init__loader(self): loader = Loader() - custom = SpecLoader([], loader=loader) + custom = SpecLoader(loader=loader) self.assertIs(custom.loader, loader) @@ -260,8 +252,7 @@ class TemplateSpecTests(unittest.TestCase): # TODO: rename this method to _make_loader(). def _make_locator(self): - locator = SpecLoader(search_dirs=[DATA_DIR]) - return locator + return SpecLoader() def _assert_template_location(self, view, expected): locator = self._make_locator() |