Message from discussion
Is it possible to reassign to a new variable name in a Mako template?
Date: Tue, 23 Oct 2012 15:49:01 -0700 (PDT)
From: Tom Stratton <t...@tomstratton.net>
To: mako-discuss@googlegroups.com
Message-Id: <607efe43-af2f-43fa-9514-f835446ea11a@googlegroups.com>
Subject: Is it possible to reassign to a new variable name in a Mako
template?
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_2542_3365959.1351032541772"
------=_Part_2542_3365959.1351032541772
Content-Type: multipart/alternative;
boundary="----=_Part_2543_32469462.1351032541772"
------=_Part_2543_32469462.1351032541772
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Hi -
Very new and struggling a little. The Mako community could benefit greatly
from more examples on the website - if I every "get it" I'll try to
contribute.
I'm trying to use Mako NOT for html page output but to create a relative
simple way for a client to format output from another script. What I was
hoping to do was pass a dictionary into the render and then reassign the
different pieces of the dict to variable names in the template.
Seems that if I ever have a ${} on the right hand side of any assignment
then I get an error...
<%
foo= 'some values'
%>
${foo}
works but if I try
<%
foo= ${somevariable}
%>
${foo}
it always generates an error.
Am I simply not going to be able to do this?
------=_Part_2543_32469462.1351032541772
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Hi -<div><br></div><div>Very new and struggling a little. The Mako communit=
y could benefit greatly from more examples on the website - if I every "get=
it" I'll try to contribute.</div><div><br></div><div>I'm trying to use Mak=
o NOT for html page output but to create a relative simple way for a client=
to format output from another script. What I was hoping to do was pass a d=
ictionary into the render and then reassign the different pieces of t=
he dict to variable names in the template. </div><div><br></div><div>S=
eems that if I ever have a ${} on the right hand side of any assignment the=
n I get an error... </div><div><br></div><div><div><%</div><div>foo=
=3D 'some values'</div><div>%><br></div></div><div>${foo}</div><div><br>=
</div><div>works but if I try</div><div><br></div><div><div><div><%</div=
><div>foo=3D ${somevariable}</div><div>%><br></div></div><div>${foo}</di=
v></div><div><br></div><div><br></div><div>it always generates an error.</d=
iv><div><br></div><div>Am I simply not going to be able to do this?</div>
------=_Part_2543_32469462.1351032541772--
------=_Part_2542_3365959.1351032541772--