[Zope] xmlrpc and zope objects

Phil Harris Phil Harris" <phil@harris-family.info
Fri, 10 May 2002 07:43:48 +0100


Derek

The thing with calling Zope (Python?) methods through xml-rpc is that
xml-rpc is purely positional in the way it uses parameters, while a lot of
Zope (Python?) is a mixture of named and positional.

While named parameters are a great thing when you want default values, other
times (such as this) they can cause a problem.  The only real answer is to
discover what the default values are and make sure that all parameters
required are passed.

The other big problem of course is that xml-rpc has no notion of 'None' or
any representation of it.  This can cause problems where None is a valid
value for a parameter.

Just a few thoughts that may be pertinent :)

hth

Phil
----- Original Message -----
From: "Derek Basch" <dbasch@yahoo.com>
To: "Julián_Muñoz" <jmunoz@softhome.net>; <zope@zope.org>
Sent: Thursday, May 09, 2002 8:58 PM
Subject: Re: [Zope] xmlrpc and zope objects


> Thank you for the reply Julián_Muñoz,
>
> I meant to say DTML Document in my first posting. I
> have since fixed this problem and it seems to work
> now.
>
> However, I am having a very hard time figuring out how
> to use the Zope API functions via the xmlrpclib
> module. There is very little documentation and fewer
> examples. I have managed to make a few API functions
> work though most still return errors. I have read in
> various white papers that most of the API should work
> via xml-rpc.
>
> Does anyone have some examples they could share?
>
> Has anyone else ran into these issues?
>
> Here is a code snippet that works for me:
>
> import xmlrpclib
>
s=xmlrpclib.Server('http://localhost:8080/',xmlrpclib.BasicAuthTransport('ad
ministrator','zopeisfun'))
> print s
>
> id ='testfolder'
> title = 'testfoldertitle'
> s.manage_addFolder(id, title)
>
> are their any alternative/better ways of doing this?
>
> Thanks,
> Derek Basch
>
> > Uhm, try with to call a python method.
> > I don't know if it is possible to call a dtml
> > object. You should give him
> > the parameters it expects. ???>
> >
> > On Sun, 5 May 2002, Derek Basch wrote:
> >
> > > Hi,
> > > Please help me zope gods.........
> > >
> > > I have been trying to use/learn xmlrpclib with
> > zope
> > > using this example:> >
> > >
> > http://www.xml.com/pub/a/2000/01/xmlrpc/index2.html
> > >
> > > I followed the example and I was able to read the
> > > document_src of the 'Test' DTML Method after I
> > > repaired the modified xmlrpclib file:> >
> > >
> > http://www.zope.org/Members/teyc/pipermailXMLRPCWoes
> > >
> > > However, I cant do it again!?. If I connect to the
> > > zope server as such:
> > >
> > > import xmlrpclib
> > > z = xmlrpclib.Server('http://localhost:8080/Test',
> > >
> >
> xmlrpclib.BasicAuthTransport('administrator','password'))
> > >
> > > and attempt to view the document_src method of
> > 'Test'
> > > I get a 'resource not found' error. I know the
> > object
> > > exists because the URL of
> > http://localhost:8080/Test
> > > returns the DTML document in my browser and also
> > the
> > > error returned in my python interpreter has the
> > title
> > > of the DTML document. What am I doing wrong here?
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Mother's Day is May 12th!
> 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 )
>
>