[Zope] Passing back from a Python script

Lalo Castro laloc@cats.ucsc.edu
Fri, 18 Apr 2003 15:47:30 -0700


Hi,
	What I'm trying to do is create a list of email addresses to send to 
based on entries in a form.  My problem(s) are appending information to 
a dtml array, and passing back information from a python script.
	What I've been doing so far is: <dtml-if "User=='Bob'"><dtml-var 
"REQUEST.set('userlist',User)"></dtml-if>, but this has a serious 
limitation.  The <dtml-var "REQUEST.set('this', that)"> sets the 
variable, but it overwrites what it is setting, so that I can't, say, 
add Bob based on one criteria and then add Bill based on another criteria.
	I'd like to be able to add the users (i.e. append another element onto 
the end of the userlist array), rather than set them, but I don't know 
if the code to do that exists.  If anyone does, can you let me know?
	As an alternative to appending, I've been looking into getting a Python 
script to do a string.find and pass back the userlist information, but 
I'm unclear on how to pass the information back into the dtml-document. 
  The dtml document has:

<dtml-call expr="REQUEST.set('newvalue', string_find(User=User, 
username='Bob'))">

	The python script has

return string.find(username, User)

	I keep getting this error:

  Error Type: TypeError
Error Value: expected a character buffer object

	Can anyone tell me what I'm doing wrong?  Or how to pass back the 
information?

	Thanks in advance,
-- 
Lalo Castro
Programmer/Analyst
McHenry Library
(831) 459-5208