xml-rpc.binary and 'seek' (was Re: [Zope] xml-rpc authentication)

Tim Hicks tim@sitefusion.co.uk
Mon, 2 Jul 2001 13:07:36 +0100


----- Original Message -----
From: "Andy McKay" <andym@ActiveState.com>
To: "Tim Hicks" <tim@sitefusion.co.uk>; <zope@zope.org>; "David Burton"
<eloquence@eloquent-designs.f2s.com>
Cc: <laird@ecn.purdue.edu>
Sent: Friday, June 29, 2001 9:00 PM
Subject: Re: xml-rpc.binary and 'seek' (was Re: [Zope] xml-rpc
authentication)


> You might try using base64 encoding and decoding.

Andy, you've saved me again.  Here's what I use from the 'client' end,

-----start scriptlet----------

from Shared.UoB.xmlrpclibBasicAuth import Server
import xmlrpclib, base64

def transfer2server(self, url, image, img_id,):
        s = Server(url, 'username', 'password')
        s.doimage(img_id, base64.encodestring(image))

-----end scriptlet----------

The 'doimage' method on the remote system simply has a base64.decodestring()
and then does what it wants.  In my case, manage_addImage().

Thanks very much.

tim




> Cheers.
> --
>   Andy McKay.
>
>
> ----- Original Message -----
> From: "Tim Hicks" <tim@sitefusion.co.uk>
> To: "Andy McKay" <andym@activestate.com>; <zope@zope.org>; "David Burton"
> <eloquence@eloquent-designs.f2s.com>
> Cc: <laird@ecn.purdue.edu>
> Sent: Thursday, June 28, 2001 6:41 PM
> Subject: xml-rpc.binary and 'seek' (was Re: [Zope] xml-rpc authentication)
>
>
> > ----- Original Message -----
> > From: "Andy McKay" <andym@ActiveState.com>
> > To: "Tim Hicks" <tim@sitefusion.co.uk>; <zope@zope.org>
> > Sent: Thursday, June 28, 2001 5:48 PM
> > Subject: Re: [Zope] xml-rpc authentication
> >
> >
> > > > Where should I put this code?  Do I need to make any more
alterations
> > > (other
> > > > than subclassing 'transport' as opposed to 'xmlrpclib.transport')?
> > >
> > > Nope. ZSyncer, uses a script based on Amos's original code very
> > successfully
> > > btw. I use it a great deal. If you look at that python it might help
> > > basically just put xmlrpclibBasicAuth.py (from ZSyncer) in
Zope/bin/lib.
> > >
> > > And instead of calling xmlrpclib, call xmlrpclibBasicAuth:
> > >
> > > from xmlrpclibBasicAuth import Server
> > > s = Server('http://foo.bar.com', 'user', pwd')
> > > s.hello()
> >
> > Andy,
> >
> > thats great.  It works a treat :-))).  I've now found another little
> > problem.  I can call any method on the remote Zope server that simply
> > requires plain text arguments, but when I try to send binary over, I
get,
> >
> > Error Type: AttributeError
> > Error Value: seek
> >
> > This is whether I use xmlrpclib.binary(mybinarydata) or simply pass
> > mybinarydata.  I searched the zope list, and found that 'Kyler B. Laird'
> > posted a message with this very problem (hence Kyler being cc'd - hope
you
> > don't mind Kyler), but there was no reply to it, so I couldn't find out
> > how/if there was a resolution.  Do you have any idea what I'm doing
wrong?
> >
> > thanks
> >
> > tim
> >
> > ps Just like to say thanks David for your suggested solution.  I went
with
> > Andy's simply because his mail arrived first.  I appreciate your time.
> Your
> > 'method' was actually very instructive for me in the ways of python :-).
> >
>