[Zope] Testing if a string isn't empty

Schmidt, Allen J. aschmidt@nv.cc.va.us
Wed, 16 May 2001 09:24:22 -0400


I have a similar need...with a twist. I was going to just wrap the whole
thing in a dtml-try block but thought I would ask.

I have a folder of images called 'images'.
I have a database field called LOGO and a form field called LOGO in an
update form that is loaded with values retrieved from the DB. 

When submitting the form, in my ZSQL method, I check to see if there is an
image name (text) in the DB field LOGO. If there is, see if it matches an
image object with the same name in the 'images' folder.
If it matches, and there is a NEW image (selected from the file system with
a 'type=file') that needs to replace the image object of the name in the
LOGO form field.

If there is a value in the LOGO database field, but no image object exists
with that name, then use the selected image filename chosen to create a new
image object with that name as the object ID.

Thanks

Allen

-----Original Message-----
From: Phil Harris [mailto:phil.harris@zope.co.uk]
Sent: Wednesday, May 16, 2001 8:33 AM
To: Gitte Wange; zope@zope.org
Subject: Re: [Zope] Testing if a string isn't empty


My first take would be something like (untested):

<dtml-unless mc_name>
  <dtml-call "REQUEST.set('mc_name','Clipname')">
</dtml-unless>

Phil
----- Original Message ----- 
From: "Gitte Wange" <gitte@mmmanager.org>
To: <zope@zope.org>
Sent: Wednesday, May 16, 2001 1:22 PM
Subject: [Zope] Testing if a string isn't empty


> Hello,
> 
> I am trying to make some dtml code that tests if a string contains text 
> (because if the string is empty it must be set to contain 'Clipname').
> 
> Right now the code looks like this:
> <dtml-if expr="mc_name == ''">
>   <dtml-let mc_name="'Clipname'">
>    <dtml-call sqlAddClip>
>   </dtml-let>
> </dtml-if>
> 
> How do you do it - because the above doesn't work.
> 
> Regards,
> -- 
> ************************
> Gitte Wange Jensen
> 
> System Squid Developer
> MMManager Aps
> +45 29 72 79 72
> 
> gitte@mmmanager.org
> ************************
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )


_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )