diff options
Diffstat (limited to 'pystache/defaults.py')
-rw-r--r-- | pystache/defaults.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/pystache/defaults.py b/pystache/defaults.py new file mode 100644 index 0000000..b696410 --- /dev/null +++ b/pystache/defaults.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +""" +This module provides a central location for defining default behavior. + +Throughout the package, these defaults take effect only when the user +does not otherwise specify a value. + +""" + +import cgi +import os +import sys + + +# How to handle encoding errors when decoding strings from str to unicode. +# +# This value is passed as the "errors" argument to Python's built-in +# unicode() function: +# +# http://docs.python.org/library/functions.html#unicode +# +DECODE_ERRORS = 'strict' + +# The name of the encoding to use when converting to unicode any strings of +# type str encountered during the rendering process. +STRING_ENCODING = sys.getdefaultencoding() + +# The name of the encoding to use when converting file contents to unicode. +# This default takes precedence over the STRING_ENCODING default for +# strings that arise from files. +FILE_ENCODING = sys.getdefaultencoding() + +# The starting list of directories in which to search for templates when +# loading a template by file name. +SEARCH_DIRS = [os.curdir] # i.e. ['.'] + +# The escape function to apply to strings that require escaping when +# rendering templates (e.g. for tags enclosed in double braces). +# Only unicode strings will be passed to this function. +# +# The quote=True argument causes double quotes to be escaped, +# but not single quotes: +# +# http://docs.python.org/library/cgi.html#cgi.escape +# +TAG_ESCAPE = lambda u: cgi.escape(u, quote=True) + +# The default template extension. +TEMPLATE_EXTENSION = 'mustache' |