def test_pt_files(self): from ..zpt.template import PageTemplateFile class Literal(object): def __init__(self, s): self.s = s def __html__(self): return self.s def __str__(self): raise RuntimeError("%r is a literal." % self.s) from chameleon.loader import TemplateLoader loader = TemplateLoader(os.path.join(self.root, "inputs")) self.execute( ".pt", PageTemplateFile, literal=Literal("<div>Hello world!</div>"), content="<div>Hello world!</div>", message=Message(), load=loader.bind(PageTemplateFile), )
def test_pt_files(self): from ..zpt.template import PageTemplateFile class Literal(object): def __init__(self, s): self.s = s def __html__(self): return self.s def __str__(self): raise RuntimeError("%r is a literal." % self.s) from chameleon.loader import TemplateLoader loader = TemplateLoader(os.path.join(self.root, "inputs")) self.execute(".pt", PageTemplateFile, literal=Literal("<div>Hello world!</div>"), content="<div>Hello world!</div>", message=Message(), load=loader.bind(PageTemplateFile))
def loader(cls, path): loader = BaseLoader(search_path=path) load = loader.bind(cls) return load