Hi

I'm having a problem with pyramid and chameleon concerning macros.

I have a PageTemplate with two macros. I'm trying to get a rendered
version of one of the macros in a method.

def test1() :
    renderer =   get_renderer('templates/test.pt').implementation()
    renderer.macro = 'status'
    status = true

return renderer.render(status=status)

def test2() :
    renderer =   get_renderer('templates/test.pt').implementation()
    renderer.macro = 'history'
    used = datetime.datetime.now()

return renderer.render(used=used)

When I only call test1() i get the Macro status rendered.
When I only call test2() I get the Macro history rendered.

When I call test1() and then test(2) i get an NameError: status in
method test2, because the macro status is rendered not history. If i
Call test2() an then test1() i get the NameError: used in test1()

I Think I'm doing it wrong, but i couldn't find anywhere how i can
render only a macro directly from code.

Is there any documentation how to do this correctly.

Regards
   Estartu

-- 
----------------------------------------------------------------------------
Gerhard Schmidt    | http://www.augusta.de/~estartu/    |
Fischbachweg 3     |                                    | PGP Public Key
86856 Hiltenfingen | JabberID: [email protected]       |  auf Anfrage

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to