[triangle-zpug] Quick help w/a python statement

bob gailer bgailer at gmail.com
Wed Oct 21 15:39:36 UTC 2009

Stephanie Thirolle wrote:
> Hey All,
>    I'm a relative python newbie and the following is driving me 
> crazy.  If anyone has ANY suggestions, I'd be most grateful.
> I've got a FileField called 'execsummlink'  and I want to test if the 
> field contains a file (or was left blank).  I've tried the following, 
> but no matter what I do, I get a 'true' result regardless of whether 
> the field contains anything:
> tal:condition="execsummlink"
> tal:condition="python: len(execsummlink) > 0"
> tal:condition="python: exists('here/execsummlink')"
> tal:condition="python: hasattr(here, 'execsummlink')"
> tal:condition="python: getattr(here, 'execsummlink')"
> ALL of these work with other field types (Image, string, text, etc) -- 
> any ideas why they won't work with a file field and what will??? \

Try tal:condition="python: execsummlink.filename"

Bob Gailer
Chapel Hill NC

More information about the triangle-zpug mailing list