ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> zope-List
zope-List
RE: [Zope] Testing if a string isn't empty
by Schmidt, Allen J. other posts by this author
May 16 2001 1:24PM messages near this date
RE: [Zope] longest runnig Zope | RE: [Zope] packing a data.fs from outside zope?
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@[...].uk]
Sent: Wednesday, May 16, 2001 8:33 AM
To: Gitte Wange; 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@[...].org> 
To: <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@[...].org
>  ************************
>  
>  _______________________________________________
>  Zope maillist  -  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@[...].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@[...].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 )

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved