[Zope3-dev] JSON

Jim Washington jwashin at vt.edu
Thu May 26 12:53:51 EDT 2005


Hi, all

I am working on a web app in zope3 that sends and receives data by
xmlrpc.  The problem is the client side; vcxmlrpc.js does not seem to
work properly in my app on anything but gecko and ie6+ browsers.  This
is currently not a problem because I can specify browsers for my
clients. But I would like to try to get it to work on recent konquerors,
particularly safari so that it works on the default browser on most
operating systems.

One idea I am toying with is JSON.  I read about it recently following a
comment to a Slashdot article about AJAX.

JSON is javascript object notation.  It is very lightweight compared to
xml-rpc.  In principle, a request receives javascript code that gets
exec'ed in the client.  No xml parsing or browser sniffing particularly
required.  Since my app deals with simple python dictionaries of simple
python types converted to javascript "objects", JSON seems a good fit.

json-py https://sourceforge.net/projects/json-py/ has most of what would
be necessary on the server side, and

jsolait http://jsolait.net/ has the javascript for the client side.

Both libraries are LGPL.

In theory, I think it should be pretty easy to get zope3 to do JSON. 
Implementation would follow the pattern of xmlrpc in zope.app.publisher,
then some code in zope.app.publication.httpfactory to get something
different happening if the content type is "text/x-json". 

Now, the question:

I would rather not alter and maintain the foundation-level code in
zope.app.pub*.  Would it be possible to do this as a product?  Presuming
it is bad form to monkey-patch zope.app.publication.httpfactory, is
there a more component-ish way to do the same thing?  Or would it be
best to set-up a collaboration and put it in the core?

-Jim Washington


More information about the Zope3-dev mailing list