pyramid_mako has the ability to render a def directly using the 'tmpl#def.mako' syntax.
http://docs.pylonsproject.org/projects/pyramid_mako/en/latest/#using-a-mako-def-name-within-a-renderer-name On Thu, Apr 3, 2014 at 7:44 PM, Jonathan Vanasco <[email protected]>wrote: > I've run into a situation where I have some application code in a .mako > file as a 'def' statement. this file&function is used by several other > templates. > > i've come into the situation where I now also need to render this def > directly. > > i can handle that in the Mako API itself using something like > > content = Template('/path/to/file').get_def('foo').render( bar ) > > unfortunately, with this approach I won;t have all the environment > settings and configurations from Pyramid that I want. it's also a bit of a > pain trying to pull out the mako settings. > > i thought about passing a mako template as a string to > pyramid.renderers.render() , but that's not supported. > > right now, i think my only way is to create a file that simply wraps an > include and call to my file. this seems annoying and confusing for > maintenance. > > anyone have an idea on possible solutions ? > > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/pylons-discuss. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
