summaryrefslogtreecommitdiff
path: root/pystache
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-03-28 19:35:33 -0700
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-03-28 19:35:33 -0700
commitc756f24366f4365d4ee6a7c39d00423f4f188d8e (patch)
treeb59cd0f096bb1182f61862ffe25c978b27a1edfe /pystache
parent0009031032c6b2ab492ed067bb2b65d4bf3c5806 (diff)
downloadpystache-c756f24366f4365d4ee6a7c39d00423f4f188d8e.tar.gz
Added extension argument to Loader constructor.
Diffstat (limited to 'pystache')
-rw-r--r--pystache/loader.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/pystache/loader.py b/pystache/loader.py
index 2c94860..968f1bd 100644
--- a/pystache/loader.py
+++ b/pystache/loader.py
@@ -15,21 +15,25 @@ from . import defaults
class Loader(object):
- def __init__(self, encoding=None, decode_errors=None):
+ def __init__(self, encoding=None, decode_errors=None, extension=None):
"""
Construct a template reader.
Arguments:
+ decode_errors: the string to pass as the errors argument to the
+ built-in function unicode() when converting str strings to
+ unicode. Defaults to the package default.
+
encoding: the file encoding. This is the name of the encoding to
use when converting file contents to unicode. This name is
passed as the encoding argument to Python's built-in function
unicode(). Defaults to the encoding name returned by
sys.getdefaultencoding().
- decode_errors: the string to pass as the errors argument to the
- built-in function unicode() when converting str strings to
- unicode. Defaults to the package default.
+ extension: the template file extension. Pass False for no
+ extension (i.e. to use extensionless template files).
+ Defaults to the package default.
"""
if decode_errors is None:
@@ -38,8 +42,12 @@ class Loader(object):
if encoding is None:
encoding = sys.getdefaultencoding()
+ if extension is None:
+ extension = defaults.TEMPLATE_EXTENSION
+
self.decode_errors = decode_errors
self.encoding = encoding
+ self.extension = extension
def unicode(self, s, encoding=None):
"""