[Zope] use path function on a python script

Garito garito at sistes.net
Sat Oct 11 10:39:34 EDT 2008


Did you imagine another way to do what I need to do?



2008/10/11 Dieter Maurer <dieter at handshake.de>

> Garito wrote at 2008-10-8 10:46 +0200:
> >How can I import the TALES funcion path on a python script?
>
> You cannot -- while it looks like a normal function, it not really is one.
>
> "path" gets a string but interprets this string with knowledge
> about the template's namespace. This shows you that some magic
> must be in the background that provides the template namespace
> to whatever implements "path".
> This magic is unavailable in a "Script Python".
>
>
> In fact, the "path" handling is prepared in
> "Products.PageTemplates.PythonExpr.PythonExpr._bind_used_names"
> by the following code:
>
>        for vname in self._f_varnames:
>            val = vars.get(vname, _marker)
>            if val is _marker:
>                has = val = getType(vname)
>                if has:
>                    val = ExprTypeProxy(vname, val, econtext)
>                    names[vname] = val
>
> The last two lines bind "path" to
> "ExprTypeProxy('path', val, econtext)".
> This is what comes nearest to "the TALES function path".
> As you can see, it is not a simple function but one provided with lots of
> context information (behind the scenes).
> The "econtext" contains the template's namespace.
>
>
>
> --
> Dieter
>



-- 
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20081011/7a4bcb71/attachment.html 


More information about the Zope mailing list