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 ************************
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 )
On Wednesday 16 May 2001 14:32, Phil Harris wrote:
My first take would be something like (untested):
<dtml-unless mc_name> <dtml-call "REQUEST.set('mc_name','Clipname')"> </dtml-unless>
Phil
It works !! Thanx :-) Gitte
----- 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 )
<dtml-let st="''"> <!--create an empty string - "-'-'-" --> <dtml-if "not st"><!-- test it --> The test worked <!--voila!--> </dtml-if> </dtml-let> Tom P [Gitte Wange] 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.
participants (4)
-
Gitte Wange -
Gitte Wange -
Phil Harris -
Thomas B. Passin