Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install products.jsonserver

How to install Products.jsonserver

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install products.jsonserver
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.2b5
1.2b6Never BuiltWhy not?
1.2b5 Available View build log
1.2b1 Available View build log
1.2a1 Available View build log
Windows (64-bit)
1.2b5
1.2b6Never BuiltWhy not?
1.2b5 Available View build log
1.2b1 Available View build log
1.2a1 Available View build log
Mac OS X (10.5+)
1.2b5
1.2b6Never BuiltWhy not?
1.2b5 Available View build log
1.2b1 Available View build log
1.2a1 Available View build log
Linux (32-bit)
1.2b6 Available View build log
1.2b5 Available View build log
1.2b1 Available View build log
1.2a1 Available View build log
Linux (64-bit)
1.2b6 Available View build log
1.2b5 Available View build log
1.2b1 Available View build log
1.2a1 Available View build log
 
Author
License
GPL
Dependencies
Lastest release
version 1.2b6 on Aug 17th, 2013

Serve JSON-RPC requests from Zope2.

Documentation

The product patches the publisher to serve JSON/RPC requests from within Zope2. It is based on:

  • original product for earlier versions of Zope2 by Balazs Ree
  • jsonserver for zope3 by Jim Washington jwashin@vt.edu and Contributors
  • ZPublisher/xmlrpc.py

JSON is javascript object notation. JSON-RPC performs the same service as XML-RPC, except the format is javascript script objects instead of XML, and the content-type is 'application/json-rpc' instead of 'text/xml'.

This project overrides some base zope2 code to provide the additional functionality of listening and responding properly to requests of type "application/json".

The product was tested with Zope 2.10 and Zope 2.13

Installation:

Add this egg to your Zope/Plone buildout.

Usage:

Similar to xmlrpc usage.

jsonserver looks for content-type "application/json", and handles those requests as JSON-RPC. Other http requests are not affected and will presumably work as expected.

For communication other than in a web browser (javascript), simplejson or other json implementations have functions for reading and writing JSON objects.

The text of a JSON-RPC request looks like:

{'id':jsonid,''method':remotemethod,'params':methodparams}

where:

o jsonid is a string or number that may identify this specific request

o remotemethod is the method to call on the server

o methodparams is a list(javascript Array) of parameters to the method

The text of a JSON-RPC response looks like:

{'id':jsonid,''result':returnedresult,'error':returnederr}

where:

o jsonid is the same jsonid as sent in the request

o returnedresult is a javascript representation of the result or null

o returnederr is a javascript representation of an error state

Either returnedresult or returnederr will be the javascript null value.

Actual implementation using e.g., urllib is left as an exercise for the reader. Hint: Use the minjson.write(object) and minjson.read(string) methods for conversion before and after transport.

Five extensions

The "json" namespace (http://namespaces.zope.org/json) defines the page and pages directives. json:page is identical to browser:page in the usage, but the page or method declared is allowed to be called up in a json request, but will be invisible for normal requests.

browser:page and browser:pages declarations will be available to both normal and json requests.

json:page declarations will be callable from code and their macros will be visible from other templates.

<json:page
    name="myjsonrpcview"
    for="*"
    class=".jsonrpc.MyJsonRpcView"
    permission="zope2.ViewManagementScreens"
    />
Code:

The code of the product can be found at: https://bitbucket.org/tomgross/products.jsonserver

Change history

1.2b6 (2013-06-17)
  • Plone 4.3 compatibility [rristow]
1.2b5 (2012-03-21)
  • Include zcml files in Manifest.in [tom_gross]
1.2b4 (2012-03-21)
  • Another Manifest.in fix [tom_gross]
1.2b3 (2012-03-21)
  • Added Manifest.in and fixed broken egg [tom_gross]
1.2b2 (2012-03-20)
  • Use simplejson/json instead of minjson implementation [tom_gross]
  • Allow utf-8 as input encoding only [tom_gross]
  • Zope 2.13 compatibility [tom_gross]
  • Fixed issue occured if used with diazo [tom_gross]
1.2b1 (2011-10-07)
  • fixed content-type with charset [tom_gross, thanks Steve Spicklemire]
  • changed has_key with __contains__ calls [tom_gross]
  • fixed sending of unauthorized status [tom_gross]
  • return error object according to the JSON-RPC specification http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html#ErrorObject [tom_gross, thanks Steve Spicklemire]
1.2a1 (2010-07-15)

Contributors

  • Tom Gross, Author
  • Balazs Ree
  • Rodrigo Ristow

Subscribe to package updates

Last updated Aug 17th, 2013

Download Stats

Last month:3

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.