/usr/lib/python2.7/dist-packages/chameleon/zpt/loader.py is in python-chameleon 2.6.1-2.
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 | from chameleon.loader import TemplateLoader as BaseLoader
from chameleon.zpt import template
class TemplateLoader(BaseLoader):
formats = {
"xml": template.PageTemplateFile,
"text": template.PageTextTemplateFile,
}
default_format = "xml"
def __init__(self, *args, **kwargs):
formats = kwargs.pop('formats', None)
if formats is not None:
self.formats = formats
super(TemplateLoader, self).__init__(*args, **kwargs)
def load(self, filename, format=None):
"""Load and return a template file.
The format parameter determines will parse the file. Valid
options are `xml` and `text`.
"""
cls = self.formats[format or self.default_format]
return super(TemplateLoader, self).load(filename, cls)
__getitem__ = load
|