/usr/lib/python3/dist-packages/chameleon/config.py is in python3-chameleon 2.24-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | import os
import logging
log = logging.getLogger('chameleon.config')
environment = dict(
(k[10:], v) for (k, v) in (
((j.lower(), x) for (j, x) in os.environ.items()))
if k.startswith('chameleon_')
)
# Define which values are read as true
TRUE = ('y', 'yes', 't', 'true', 'on', '1')
# If eager parsing is enabled, templates are parsed upon
# instantiation, rather than when first called upon; this mode is
# useful for verifying validity of templates across a project
EAGER_PARSING = environment.pop('eager', 'false')
EAGER_PARSING = EAGER_PARSING.lower() in TRUE
# Debug mode is mostly useful for debugging the template engine
# itself. When enabled, generated source code is written to disk to
# ease step-debugging and some log levels are lowered to increase
# output. Also, the generated source code is available in the
# ``source`` attribute of the template instance if compilation
# succeeded.
DEBUG_MODE = environment.pop('debug', 'false')
DEBUG_MODE = DEBUG_MODE.lower() in TRUE
# If a cache directory is specified, template source code will be
# persisted on disk and reloaded between sessions
path = environment.pop('cache', None)
if path is not None:
CACHE_DIRECTORY = os.path.abspath(path)
if not os.path.exists(CACHE_DIRECTORY):
raise ValueError(
"Cache directory does not exist: %s." % CACHE_DIRECTORY
)
log.info("directory cache: %s." % CACHE_DIRECTORY)
else:
CACHE_DIRECTORY = None
# When auto-reload is enabled, templates are reloaded on file change.
AUTO_RELOAD = environment.pop('reload', 'false')
AUTO_RELOAD = AUTO_RELOAD.lower() in TRUE
for key in environment:
log.warning(
"unknown environment variable set: \"CHAMELEON_%s\"." % key.upper()
)
# This is the slice length of the expression displayed in the
# formatted exception string
SOURCE_EXPRESSION_MARKER_LENGTH = 60
|