[Zope] Page Template help

Garito garito at sistes.net
Tue Aug 12 09:03:28 EDT 2008


Yeah, Mustaha!
Sometimes I think I'm a little stupid, jejejeje, I have in front of my nose
but I don't see it

I was solved the problem adding a y: type expression and then subclass the
PythonExpr with the __init__ method modified to change the expression

Too much difficult to do the job in an acceptable way

BUT!!!

If you go to usr/lib/zope<version>/lib/python/zope/tales/tales.py and change
the 592 and 593:

591    else:
592        type = "standard"
593        expr = expression

to

else:
    if expression.find('${') > -1:
        type = "python"
        expr = "path(path('string:%s'))" % expression
    else:
        type = "standard"
        expr = expression

then you could use expressions like this

path/to/render/${with/some/variable}/and/the/rest/of/the/path

I think it's an acceptable change to the code for the job it does
I don't know if Zope people will introduce this change but I think if not
they will be wrong

But they are absolute free to do what they want to do, don't misunderstand
me, please

2008/8/12 mustapha <mustapha at headnet.dk>

>
> I'm not sure I get what you want to do.
>
> It is not the page template that decides about the expression but the
> engine as Philpp explained before.
>
> anyway, I think you are looking for the "compile" method of the
> ExpressionEngine class (look in zope/tales/tales.py). It's there where
> the expressions are parsed.
>
> HTH
>
> Garito wrote:
> > Yes, it's ok but I can save n variable definitions with 4 lines of code
> > in 1 point
> > Seems quite interesting for me
> >
> > Could someone point me were the page template decides if the expression
> > is a standard, string, python, etc one, please? ;)
> >
> > 2008/8/11 Philipp von Weitershausen
> > <philipp at weitershausen.de
> > <mailto:philipp at weitershausen.de>>
> >
> >     Garito wrote:
> >      > Considere this case:
> >      >
> >      > I have the sking value in the variable at args/Yanged/Skin
> >      >
> >      > How can I do the equivalent to
> >      >
> >      >
> >
> args/Yanged/raiz/Skins/${args/Yanged/Skin}/arbolYanged.css/absolute_url
> >      >
> >      > ?
> >      >
> >      > In the python way it will be:
> >      >
> >      > path(path('string:' +
> >      >
> >
> 'args/Yanged/raiz/Skins/${args/Yanged/Skin}/arbolYanged.css/absolute_url'))
> >      >
> >      > That's returns the expected value but I can't see how to do with
> your
> >      > propossed way
> >
> >
> >     <a tal:define="skin args/Yanged/Skin;
> >                    file args/Yanged/raiz/Skins/?skin/arbolYanged.css"
> >        tal:attributes="href file/absolute_url">
> >
> >     _______________________________________________
> >     Zope maillist  -  Zope at zope.org
> >     <mailto:Zope at zope.org>
> >     http://mail.zope.org/mailman/listinfo/zope
> >     **   No cross posts or HTML encoding!  **
> >     (Related lists -
> >      http://mail.zope.org/mailman/listinfo/zope-announce
> >      http://mail.zope.org/mailman/listinfo/zope-dev )
> >
> >
> >
> >
> > --
> > Mis Cosas
> > http://blogs.sistes.net/Garito
> > Zope Smart Manager
> > http://blogs.sistes.net/Garito/670
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Zope maillist  -  Zope at zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://mail.zope.org/mailman/listinfo/zope-announce
> >  http://mail.zope.org/mailman/listinfo/zope-dev )
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>



-- 
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/20080812/52dc59bb/attachment.html 


More information about the Zope mailing list