[Zope] ZPT Help!
Michael Fox
Michael at CenturySoftware.com.au
Tue Jul 20 23:58:05 EDT 2004
That's work great, thanks Paul!
-----Original Message-----
From: zope-bounces+michael=centurysoftware.com.au at zope.org
[mailto:zope-bounces+michael=centurysoftware.com.au at zope.org] On Behalf
Of Paul Winkler
Sent: Wednesday, 21 July 2004 3:21 AM
To: zope at zope.org
Subject: Re: [Zope] ZPT Help!
On Tue, Jul 20, 2004 at 03:59:22PM +1000, Michael Fox wrote:
> If there is no matching image I want to display an "image
> unavailable", but can't get this to work.
>
> <span tal:define="image string:${here/id}.jpg">
>
> <span tal:replace="image"></span>
>
> <span tal:condition="not:python:here.objectIds(image)">
That can't work.
objectIds() returns a list of IDs and takes no arguments.
The simplest thing would be:
<span tal:condition="python:image not in here.objectIds()" />
That could be problematically slow if there are a whole lot of objects
in the folder. You could also try:
<span tal:condition="python:not hasattr(here, image)" />
... but that is only good if you know that objects with the image ID
will not be acquired from elsewhere in the current context.
--
Paul Winkler
http://www.slinkp.com _______________________________________________
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