-----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


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          [email protected]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlQn/7IACgkQ+gerLs4ltQ58gACg2oFtRJzFWEiwfbPYtpKYF81B
zgEAn0TfOqWysisx+nto5yAmO+3pgY4K
=KMFT
-----END PGP SIGNATURE-----

-- 
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.

Reply via email to