On Sun, Dec 18, 2011 at 2:37 AM, Thijs Engels <[email protected]> wrote: > present in the application stanza of your configuration’s ini file: > mako.directories = mypackage:templates
This is necessary in order to do the normal ``renderer="mytemplate.mak")`` I learned this the hard way. I think it was present in an earlier version of the standard scaffolds, but was removed at some point. At least, it's in the Akhet scaffold, and I don't think I would have put it there if it hadn't been in the standard scaffolds. > """ > A mako.directories setting is no longer required to use Mako templates > Rationale: Mako template renderers can be specified using an absolute > asset spec. An entire application can be written with such asset specs, > requiring no ordered lookup path. > """ This means you can use an asset spec instead of a relative path. ``renderer="mypackage:templates/mytemplate.mak"`` Chameleon uses asset specs; the default scaffold has ``renderer="templates/my_template.pt"``, so I assume you can just change the extension and create the template, and it should work. http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/assets.html#asset-specifications > from pyramid.mako_templating import renderer_factory as mako_factory > config.add_renderer('.mako', mako_factory) This is built into Pyramid so you don't need to add it. Both .mak and .mako are registered for Mako. If you want to use another extension like .html, then you have to add this line. > File "C:\Projects\Pyramid\lib\site-packages\pyramid\path.py", line 26, > in caller_module > module = sys.modules[module_name] > KeyError: 'indices_mako' I got something like this when I put in an add_renderer line for .html . It wasn't exactly the same error though, and after a couple tries it seemed to go away on its own. I think the error was a setuptools.require() something, which is related (it's indirectly an import). I think I deleted my .pyc files and regenerated the package metadata ("python setup.py egg_info") to get rid of any stale files, but I can't be sure any of those fixed it. I know I didn't modify anything in the Pyramid package. By the way, I'm getting an incompatibility with ``mako.strict_undefined = true``. It raises an undefined error in the debug toolbar on 'session' if you don't have Beaker sessions set up. I'll do some more poking around and file a bug report. -- Mike Orr <[email protected]> -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
