Fetching data from external methods
Hi! I've been trying almost two weeks with this problem. I have read 'tons' on zope documentation and mailing lists. I have this dtml form, which submits two values to external method. External method searches LDAP directory with submitted values and returns an object(class) with 5-30 values. I know only how to return plain text to Zope (return obj.__dict__ or return obj.value1). How i return those values in zope and embed those values into dtml file. I have some kind of clue, how i want to do this (or do i?): can i make Zclass and return values into that and call Zclass variables in dtml? in fact only problem here is how i return values from external method like obj.value1 , obj.value2.... into zope and use them in dtml or/and in Zclass instances. Please, somobody save my nerves and help me figure solution with this problem. JarkkoV
Jarkko Veijalainen wrote:
in fact only problem here is how i return values from external method like obj.value1 , obj.value2.... into zope and use them in dtml or/and in Zclass instances.
in external method: return (obj1, obj2,) in DTML: <dtml-in external_method(your,params)> <dtml-var value1> <dtml-var value2> </dtml-in> If you are submitting to your external method from an HTML form, you will need to return the HTML to be displayed: def my_external_method(self,param1,param2): ...do stuff... string = '<HTML><BODY>' string = string + ...render your results here... string = string + '</BODY></HTML>' return string HTH, Chris
----- Original Message ----- From: Jarkko Veijalainen <Jarkko.Veijalainen@tecnomen.fi> To: <zope@zope.org> Sent: Wednesday, July 12, 2000 2:37 PM Subject: [Zope] Fetching data from external methods
I have this dtml form, which submits two values to external method. External method searches LDAP directory with submitted values and returns an object(class) with 5-30 values. I know only how to return plain text to Zope (return obj.__dict__ or return obj.value1). How i return those values in zope and embed those values into dtml file.
I have some kind of clue, how i want to do this (or do i?): can i make Zclass and return values into that and call Zclass variables in dtml?
in fact only problem here is how i return values from external method like obj.value1 , obj.value2.... into zope and use them in dtml or/and in Zclass instances.
I'm not sure if I understood your problem. But why don't you return the `entire' object ?! return obj and you will use as you want in DTML You can also call return obj.__dict__.values() is a list, but order or the values is unpredictable (I think) PM _______________________________ "Will I be using Python today?" and if the answer is "yes" I know that it's going to be a good day.
participants (3)
-
Chris Withers -
Jarkko Veijalainen -
Marcel Preda