[Zope] Render a string as tal

Alan Warren awarren.pub at gmail.com
Wed Nov 16 09:59:33 EST 2005


Hi,

I'm not sure I entirely understand the goal here either, but you may
want to look into the path method.

Here's what I recently had to use it for.

I'm building a little photo album application for my sister, it
supports nested albums.  I had a page template called view I was using
as a method, but wanted to logically group the actions specific to a
single image into a folder.  So, I have a folder called view.  When an
image is viewed the URL looks like
/some_album/some_pic.jpg/view/?display=large

If I want to do operations or locate properties on some_pic.jpg I
extract that part of the URL, and then pass it to the path function.

The code looks like this:
<span tal:define="imgName python:request['URL2'][len(request['URL3']+1:]">
    <span tal:define="global imgObj python:path('here/'+imgName)"></span>
</span>

HTH,
Alan

On 11/16/05, Chris Withers <chris at simplistix.co.uk> wrote:
> Mark Gibson wrote:
> > However, what I'm looking for is being able to take a string such as
> > '<div tal:content="here/absolute_url">The url</div>'
> >
> > and be able to evaluate the TALES expression in the string to produced
> > something like: '<div>http://mydomain.com/theUrl</div>'
> >
> > Any chance there's a recipe for this?
>
> If you can explain to us why you think you want to do that, we can
> likely tell you what you really want to be doing ;-)
>
> Chris
>
> --
> Simplistix - Content Management, Zope & Python Consulting
>             - http://www.simplistix.co.uk
>
> _______________________________________________
> 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 )
>


More information about the Zope mailing list