On 09/28/2014 08:31 AM, Tres Seaver wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/28/2014 04:33 AM, Gerhard Schmidt wrote:

is there a way to the a view to only render a macro in view.

The simplest would be to write a one-ilne template:

   <html metal:use-macro="source/macros/?macro"/>

and then use it as the renderer for a view which returned the source
template and the macro name in its mapping:

   from pyramid.renderers import get_renderer
   from pyramid.view import view_config

   @view_config(name="uses_foo_macro.html",
                renderer="templates/one_liner.pt")
   def uses_foo_macro(context, request):
       source = get_renderer('templates/source.pt')
       info = {'source': source, 'macro': 'foo'}
       # Add other info
       return info

You can also just use the macro name in the view_config renderer name: <http://pyramid-chameleon.readthedocs.org/en/latest/#using-a-chameleon-macro-name-within-a-renderer-name>



--
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 pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to