[prev in list] [next in list] [prev in thread] [next in thread]
List: zope
Subject: [Zope] Using Template in script (python)
From: "Miguel Beltran R." <yourpadre () gmail ! com>
Date: 2015-04-08 21:19:04
Message-ID: CAEc04cpNeoUKF1Jcv8X6e0LuboZV-kA=mVqCpL-D4KYU3H+zdg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi list,
I'm trying to use the make a string using a Template and fill it with the
result of a query, but gime this error
You are not allowed to access 'safe_substitute' in this context
Zope = 2.12
from string import Template
rst=someSQL()[0]
txt=Template("""
<span id="datos_vehiculo"
data-placa="${placa}"
data-serie="${serie}"
data-marca="${marca}"
data-submarca="${submarca}"
data-modelo="${modelo}">
</span>
""")
newtxt=txt.safe_substitute(rst)
do exist some way to do it?
--
________________________________________
Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida
[Attachment #5 (text/html)]
<div dir="ltr"><div><div>Hi list,<br></div><div>I'm trying to use the make a \
string using a Template and fill it with the result of a query, but gime this \
error<br>You are not allowed to access 'safe_substitute' in this \
context<br></div><div><br></div>Zope = 2.12<br><br></div><div>from string import \
Template<br></div>rst=someSQL()[0]<br \
clear="all"><div><div><div><div><div>txt=Template("""<br><span \
id="datos_vehiculo"<br> data-placa="${placa}"<br> \
data-serie="${serie}"<br> data-marca="${marca}"<br> \
data-submarca="${submarca}"<br> \
data-modelo="${modelo}"><br></span><br>""")<br></div><div>newtxt=txt.safe_substitute(rst)<br><br></div><div>do \
exist some way to do it?<br></div><div>-- <br><div \
class="gmail_signature">________________________________________<br>Lo bueno de vivir \
un dia mas<br>es saber que nos queda un dia menos de vida</div> \
</div></div></div></div></div></div>
_______________________________________________
Zope maillist - Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope-dev )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic