Manipulating HTML tag attributes

Analog Kid <[email protected]> Tue, 8 Jan 2013 17:37:11 +0530
Newsgroups gmane.comp.python.cheetah
Message-ID <CAOg_RrzrtomRuAaOkVJ15AtnPqOu6cmDaQ83Gfdgr_R_sxz+tg@mail.gmail.com>
--===============2385922841178994632==
Content-Type: multipart/alternative; boundary=bcaec50dc0f624984f04d2c5c91c

--bcaec50dc0f624984f04d2c5c91c
Content-Type: text/plain; charset=UTF-8

Hi All:

Im a noob to Cheetah. I had a question: I have a .py file which uses a
.tmpl template file to render some html. In the template, I need to
manipulate an HTML tag attribute. Something like this:
... snip
<select name=category value=req.category>
  <option value="cars">Cars</option>
  ...................
...snip

I call this template from the py file like this:

#!/usr/local/bin/python
from cgi import parse
from Cheetah.Template import Template

print "Content-Type: text/html\n"
req=parse()
print Template(file="somepage.tmpl", searchList = [{'req': req}])


This doesnt seem to work. Am I passing parameters correctly. What am I
missing?

TIA,
Ajay

--bcaec50dc0f624984f04d2c5c91c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div>Hi All:<br><br></div>Im a noob to Cheetah. =
I had a question: I have a .py file which uses a .tmpl template file to ren=
der some html. In the template, I need to manipulate an HTML tag attribute.=
 Something like this:<br>
</div><div>... snip<br></div>&lt;select name=3Dcategory value=3Dreq.categor=
y&gt;<br></div><div>=C2=A0 &lt;option value=3D&quot;cars&quot;&gt;Cars&lt;/=
option&gt;<br>=C2=A0 ...................<br></div>...snip<br><div><br></div=
><div>I call this template from the py file like this:<br>
<br>#!/usr/local/bin/python<br>from cgi import parse<br>from Cheetah.Templa=
te import Template<br><br>print &quot;Content-Type: text/html\n&quot;<br>re=
q=3Dparse()<br></div><div>print Template(file=3D&quot;somepage.tmpl&quot;, =
searchList =3D [{&#39;req&#39;: req}])<br>
<br><br></div><div>This doesnt seem to work. Am I passing parameters correc=
tly. What am I missing?<br><br></div><div>TIA,<br></div><div>Ajay</div><br>=
</div>

--bcaec50dc0f624984f04d2c5c91c--


--===============2385922841178994632==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
--===============2385922841178994632==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

--===============2385922841178994632==--