Log in |
XMLRPC with ZClassesWhats newI will be posting some follow-up discussion about this topic on http://www.zope.org/Members/teyc/howtoXMLRPC2 [Zope] XML-RPC WoesKapil V. Thangavelu [email protected] Thu, 16 Mar 2000 13:37:07 -0500
Previous message: [Zope] XML-RPC Woes Next message: [Zope] Zcatalog's TextIndex Question Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] After getting a few private emails with questions about what i was doing i thought i'd share what i'd learned and some code. First an apologyI read through my original email and realized that i was a bit to vague to really get any help, mainly because i don't understand what i'm passing through xml-rpc to dtml methods that are expecting Zope stuff (client, mapping, kw). Second, what i'm doing.I'm creating an email archive in zope. i wrote up some python code that retrieves/parses email from a pop3 server and then inserts via xml-rpc into a zclass so that it can be archived and cataloged. I got the whole thing working last night by passing the parsed info in a dict via xml-rpc to an external method which took care of adding the Zclasses in Zope, basically following the example from this howto http://www.zope.org/Members/teyc/howxmlrpc Third, How to do XML-RPC with Amos's patched xmlrpclib.py for authentication:
Fourth, External Method Code:all code is provided on as is basis for the purpose of an example. use at your own risk. def import_mail(self, props):
id = props['id']
mailobj=self.manage_addProduct['YourProduct'].YourZClass.createInObjectManager(id,self.REQUEST)
mailobj.propertysheets.YourPropertySheet.manage_changeProperties(props)
return "Zope is Cool"
this is one of those times you just look at zope and sigh. so much power if you know how to use it. i actually got the basis of this code from the Zope CD that they passed out at the python conference(8). this method is part of the archive folder called below. Fifth, the XML-RPC callFrom the python script without error checking:
I hope this helps. if anyone has any examples of passing args to dtml methods via xml-rpc i'd love to see them. Cheers, Kapil
-------------------------------------------------------------------------------- |