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

Rob Lineberger rob_lineberger at med.unc.edu
Wed Oct 21 15:13:17 UTC 2009


That sounds like the Plone wall we've all hit at one time or another.   

I'm not somewhere that I can test this, but you might try this statement
to test if execsumlink is an instance of file:
tal:condition="python: isinstance(execsummlink, file)"

Also, it might be returning true because it thinks execsummlink is a
string. Try tal:condition="here/execsummlink."




On Wed, 2009-10-21 at 10:23 -0400, 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???
> 
> Thanks SO much for your time.
> 
> Cheers!
> Stephanie
> 





More information about the triangle-zpug mailing list