[Zope] External Methods

Edward Muller edwardam@home.com
Wed, 22 Nov 2000 14:38:23 -0500 (EST)


I'm a little new to the python sde of zope and haven't done much with the other
side (dtml,etc), but am getting back into it...So here is how I think you can do
it (note: I've done this myself recently...I'm writing a product, that started
off as a collection of external methods)...

So you have a html form with a submit button. that calls a url
(http://yoursite/folder/externalmethodname)

lets say your form has two valiables it wants to pass to the method. Let's say
the variables are 'foo' and 'foo2'. 

now define you external method in a file in the <zope path>/Extension
directory..

lets call the file bar.py

okay define your method in the file

def imamethod(self,REQUEST=non):
	dosomethingwith(REQUEST['foo'])  #variable foo from the form
	dosomethingwith(REQUEST['foo2']) #other variable from the form
	REQUEST.RESPONSE.setHeader('content-type','text/html')
	REQUEST.RESPONSE.body('<HTML><BODY>Done!</BODY></HTML>')

That's it I think..

This is from memory so I am sure there are some things wrong with it. If anyone
cares to comment (i.e. the zope community) please let me know....

On Tue, 21 Nov 2000, Kini Natekar wrote:

> 
> Hi,
> 
>    I have got a html form which accepts an input from
> the user. This input has to be passed to a Python
> script, as a parameter, which is added as an external
> method in zope. 
>    Is there any way to do this ?
> 
> 
> Regards,
> Kini.
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/
> 
> _______________________________________________
> 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 )
> 

-- 
...EAM...
edwardam@home.com
edwardam@handhelds.org
-----------------------
'It's because crappy programs offend me.' --Eric Raymond
Grow a ponytail -- view it as your telepathic antenna to other Linux Kernel Developers. -- Jeff V. Merkey