I was reading earlier postings about 'variables' or the lack of them in Zope and I went off and investigated Python Methods and External Methods and I've got them working ... but .. I can't figure out how to use them to solve my problem ... I have an SQL method and I've generated the form and results report using the standard wizard - absolutely wonderful. Let's say I have an input variable, called 'customer' on the form which is passed to the SQL method. BUT I want to intercept that variable and do something with it, let's keep it simple and say that I want to put the string "CT" in front of what the user enters (I know that's trivial but for the sake of argument). I can write an External Method or Python Method which does the necessary but it returns the string back to the calling object as text which is displayed by the browser. Can anyone tell me how to get that new string back into the variable 'customer'. Please :-) Richard Moon richard@dcs.co.uk
update table set customer=<dtml-sqlvar "'DT'+_['form_variable']" type=string> where key=form_key ----- Original Message ----- From: Richard Moon <richard@dcs.co.uk> To: <zope@zope.org> Sent: Wednesday, February 23, 2000 12:43 PM Subject: [Zope] Calculations - more dumb questions. I was reading earlier postings about 'variables' or the lack of them in Zope and I went off and investigated Python Methods and External Methods and I've got them working ... but .. I can't figure out how to use them to solve my problem ... I have an SQL method and I've generated the form and results report using the standard wizard - absolutely wonderful. Let's say I have an input variable, called 'customer' on the form which is passed to the SQL method. BUT I want to intercept that variable and do something with it, let's keep it simple and say that I want to put the string "CT" in front of what the user enters (I know that's trivial but for the sake of argument). I can write an External Method or Python Method which does the necessary but it returns the string back to the calling object as text which is displayed by the browser. Can anyone tell me how to get that new string back into the variable 'customer'. Please :-) Richard Moon richard@dcs.co.uk _______________________________________________ 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 )
Let's say I have an input variable, called 'customer' on the form which is passed to the SQL method. BUT I want to intercept that variable and do something with it, let's keep it simple and say that I want to put the string "CT" in front of what the user enters (I know that's trivial but for the sake of argument).
Can anyone tell me how to get that new string back into the variable 'customer'. Try: <dtml-call "REQUEST.set('customer', 'CT' + REQUEST.customer)">
Alternatively, leave the original customer alone and simply pass in the new value to your SQL method: <dtml-in "sqlmethod(customer='CT'+customer)"> ... -- Duncan Booth duncan@dales.rmplc.co.uk int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3" "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure? http://dales.rmplc.co.uk/Duncan
participants (3)
-
Duncan Booth -
Jim Sanford -
Richard Moon