<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">&lt;<a href="mailto:dieter@handshake.de">dieter@handshake.de</a>&gt;</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">&gt;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>
&quot;path&quot; gets a string but interprets this string with knowledge<br>
about the template&#39;s namespace. This shows you that some magic<br>
must be in the background that provides the template namespace<br>
to whatever implements &quot;path&quot;.<br>
This magic is unavailable in a &quot;Script Python&quot;.<br>
<br>
<br>
In fact, the &quot;path&quot; handling is prepared in<br>
&quot;Products.PageTemplates.PythonExpr.PythonExpr._bind_used_names&quot;<br>
by the following code:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;for vname in self._f_varnames:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;val = vars.get(vname, _marker)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if val is _marker:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;has = val = getType(vname)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if has:<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;val = ExprTypeProxy(vname, val, econtext)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;names[vname] = val<br>
<br>
The last two lines bind &quot;path&quot; to<br>
&quot;ExprTypeProxy(&#39;path&#39;, val, econtext)&quot;.<br>
This is what comes nearest to &quot;the TALES function path&quot;.<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 &quot;econtext&quot; contains the template&#39;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>