summaryrefslogtreecommitdiff
path: root/pystache
diff options
context:
space:
mode:
authorxgecko <jonathan@xgecko.com>2012-07-21 17:44:53 -0700
committerxgecko <jonathan@xgecko.com>2012-07-21 17:44:53 -0700
commit2b07ad52a45fb109c981dd505f63eade84be8558 (patch)
tree6e271df4ea1c50d3ec9991d2433f869c8ab4e140 /pystache
parent131c403be4c8d18ad353319497b55901c6e719e9 (diff)
downloadpystache-2b07ad52a45fb109c981dd505f63eade84be8558.tar.gz
Added load_file function
Diffstat (limited to 'pystache')
-rw-r--r--pystache/loader.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/pystache/loader.py b/pystache/loader.py
index 0fdadc5..fcbe488 100644
--- a/pystache/loader.py
+++ b/pystache/loader.py
@@ -120,9 +120,27 @@ class Loader(object):
return self.unicode(b, encoding)
# TODO: unit-test this method.
+ def load_file(self, file_name):
+ """
+ Find and return the template with the given file name.
+
+ Arguments:
+
+ file_name: the file name of the template.
+
+ search_dirs: the list of directories in which to search.
+
+ """
+ locator = self._make_locator()
+
+ path = locator.find_file(file_name, self.search_dirs)
+
+ return self.read(path)
+
+ # TODO: unit-test this method.
def load_name(self, name):
"""
- Find and return the template with the given name.
+ Find and return the template with the given template name.
Arguments: