dict->XML->dict? Or, passing small hashes through text?

mackstann mack at incise.org
Fri Aug 15 07:57:24 CEST 2003


On Fri, Aug 15, 2003 at 12:19:51AM -0500, Skip Montanaro wrote:
>     mack> I'm basically passing little messages around, which are basically
>     mack> just hashes, and up until now, I was using a dict that I formatted
>     mack> to/parsed from a special syntax, but I keep running into growing
>     mack> pains with that.  I'm using SocketServer, and each connection
>     mack> sends one line of data, and then the connection is closed by the
>     mack> server.
> 
> Check out xmlrpclib in the Python distribution for quite awhile.  It also
> interoperates with XML-RPC libraries written in other languages.

That was something I've looked at, and honestly I need to look at it
further, but at first I was turned off because it implements its own
little server, so I'd have to gut mine.  But that's not a reason to rule
it out completely.

> There are
> plenty of other choices as well, including Pyro (Irmen de Jong I believe)

Pyro looks really cool!  This tempts me to forget about non-Python
interoperability. :)  I'm actually really torn over this.

> and an XML-based pickle format from David Mertz (check
> http://www.gnosis.cx/),

This actually looks like it might be perfect!

> not to mention using marshal or pickle then
> transporting the strings using SocketServer.

This was something I was actually toying with - pickling objects, and
then converting them to base64.  The downsides are being
non-python-unfriendly, and making hand testing (e.g. typing stuff into
telnet or netcat) a little more work.

Another concern with pickle is that (I think?) I can recall reading
about how it is bad to blindly unpickle things that come in from an
untrusted source, and that makes sense, as even accessing attributes
could run arbitrary code, which seems.. bad. :)

-- 
m a c k s t a n n  mack @ incise.org  http://incise.org
Man usually avoids attributing cleverness to somebody else -- unless it
is an enemy.
		-- Albert Einstein





More information about the Python-list mailing list