From where does nothing spring from?
I am trying to add some data validation methods to my fieldProduct ( www.zope.com/Members/gchiu ) - a data entry class. I have added a method called isNotEmail which returns either a 0 or a 1. Here's the method definition: <dtml-if "_.has_key(fieldName)"> <dtml-call "REQUEST.set(_[fieldName],_.string.lower(_[fieldName]))"> <dtml-if "_.len(_[fieldName]) <8 or _.string.find(_[fieldName],'@')==-1 or _.string.find(_[fieldName],'.')==-1 or _.string.rfind(_[fieldName],'.') < _.string.find(_[fieldName],'@') or _.string.find(_[fieldName],'nospam') > 0 or _.string.find(_[fieldName],'..')>0 "> <dtml-call "REQUEST.set(_['fieldNameError'],'This is not a valid email address. Please amend.')"> <dtml-return "0"> <dtml-else> <dtml-return "1"> </dtml-if> <dtml-else> <dtml-call "REQUEST.set(_['fieldNameError'],'You need to supply a <b>valid</b> email address')"> <dtml-return "0"> </dtml-if> where fieldName and fieldNameError are properties of the class. However, when I call the method <dtml-var "REQUEST.set('error',f_Email.isNotEmail(f_Email,_))"> where f_Email is an instance of the product, then the words 'None' are returned as well, and render to the screen. Where is this coming from? -- Regards, Graham Chiu gchiu<at>compkarori.co.nz http://www.compkarori.co.nz/index.php Powered by Interbase and Zope
----- Original Message ----- From: "Graham Chiu" <anon_emouse@hotmail.com>
<dtml-var "REQUEST.set('error',f_Email.isNotEmail(f_Email,_))">
where f_Email is an instance of the product, then the words
'None'
are returned as well, and render to the screen.
REQUEST.set returns None. You want to use <dtml-call> instead of <dtml-var>, to ignore the returned value. Cheers, Evan @ 4-am & digicool
In article <001d01bfd861$1cb14470$c7da5e3f@mozart>, Evan Simpson <evan@4-am.com> writes
----- Original Message ----- From: "Graham Chiu" <anon_emouse@hotmail.com>
<dtml-var "REQUEST.set('error',f_Email.isNotEmail(f_Email,_))">
where f_Email is an instance of the product, then the words
'None'
are returned as well, and render to the screen.
REQUEST.set returns None. You want to use <dtml-call> instead of <dtml-var>, to ignore the returned value.
Thanks, that worked. -- Regards, Graham Chiu gchiu<at>compkarori.co.nz http://www.compkarori.co.nz/index.php Powered by Interbase and Zope
participants (2)
-
Evan Simpson -
Graham Chiu