<div dir="ltr">Did you imagine another way to do what I need to do?<br><br><br><br><div class="gmail_quote">2008/10/11 Dieter Maurer <span dir="ltr"><<a href="mailto:dieter@handshake.de">dieter@handshake.de</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Garito wrote at 2008-10-8 10:46 +0200:<br>
<div class="Ih2E3d">>How can I import the TALES funcion path on a python script?<br>
<br>
</div>You cannot -- while it looks like a normal function, it not really is one.<br>
<br>
"path" gets a string but interprets this string with knowledge<br>
about the template's namespace. This shows you that some magic<br>
must be in the background that provides the template namespace<br>
to whatever implements "path".<br>
This magic is unavailable in a "Script Python".<br>
<br>
<br>
In fact, the "path" handling is prepared in<br>
"Products.PageTemplates.PythonExpr.PythonExpr._bind_used_names"<br>
by the following code:<br>
<br>
for vname in self._f_varnames:<br>
val = vars.get(vname, _marker)<br>
if val is _marker:<br>
has = val = getType(vname)<br>
if has:<br>
val = ExprTypeProxy(vname, val, econtext)<br>
names[vname] = val<br>
<br>
The last two lines bind "path" to<br>
"ExprTypeProxy('path', val, econtext)".<br>
This is what comes nearest to "the TALES function path".<br>
As you can see, it is not a simple function but one provided with lots of<br>
context information (behind the scenes).<br>
The "econtext" contains the template's namespace.<br>
<br>
<br>
<br>
--<br>
<font color="#888888">Dieter<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Mis Cosas<br><a href="http://blogs.sistes.net/Garito">http://blogs.sistes.net/Garito</a><br>Zope Smart Manager<br><a href="http://blogs.sistes.net/Garito/670">http://blogs.sistes.net/Garito/670</a><br>
</div>