[Zope] Fetching data from external methods

Jarkko Veijalainen Jarkko.Veijalainen@tecnomen.fi
Wed, 12 Jul 2000 17:17:35 +0300


sorry but your example did'nt work:

>in external method:
>
>	return (obj1, obj2,)
>
>in DTML:
>
><dtml-in external_method(your,params)>
>  <dtml-var value1>
>  <dtml-var value2>
></dtml-in>

here is my submit forms code to explain my case

<form action="LDAPsearch" method=POST ENCTYPE="multipart/form-data">
       cn: <br>
    <input name="cn" size="10"><br>
       objectclass: <br>
    <input name="objectclass" size="15"><br><br>

      <input type="SUBMIT" name="send" value=" Search ">
</form>

LDAPsearch is my external method (object in zope which points to .py module)

My method outputs are:
	
	res = (contains search result using forms input values)
	sn = res.sn (one of the values in res-object)
	return sn

and i try to embed in dtml like this

	<dtml-in "LDAPsearch('666666','*',REQUEST)">
		<dtml-var sn>
	</dtml-in>


Zope returns error:
	Error Type: InError
	Error Value: Strings are not allowed as input to the in tag.

if i try to return 
	res.__dict__   in external method

zope returns this kind of error:
	Error Type: KeyError
	Error Value: 0

this works
<dtml-var "LDAPsearch('666666','*',REQUEST)">
but it lefs me with two problems
	1) how i can input values in LDAPsearch(how i input here)
	2) i don't have any control of return value, it returns list like
this
	('Ukko', '666666', 'oEmail') 

>If you are submitting to your external method from an HTML form, you
>will need to return the HTML to be
>def my_external_method(self,param1,param2):
>	...do stuff...
>	string = '<HTML><BODY>'
>	string = string + ...render your results here...
>	string = string + '</BODY></HTML>'
>	return string

this solution worked, but it's not what i really want to do. I don't want
include return HTML-file in my python script, like in that example.