qxjsonrpc 0.0.7 released - WSGI support, qooxdoo login/logout demo

Viktor Ferenczi python at cx.hu
Fri Apr 13 03:39:03 CEST 2007


The qxjsonrpc package contains everything to implement JSON-RPC backends
for WEB applications using the QooXDoo ( http://qooxdoo.org ) library or
simply requiring RPC functionality.

Download, example, etc.:
http://python.cx.hu/qxjsonrpc

Highlights of this release:

- WSGI support has been implemented. WSGI test uses the wsgiref reference
implementation from Python 2.5's standard library to server the test
application. WSGI support is not tested with other WSGI compliant servers.
There could be some tests for the Apache 2.0 mod_wsgi in the near future.

- New qooxdoo login / logout demo, uses fixed username and password.
Creates session on successful login, deletes session on logout.
Copy qooxdoo's  script and resource subdirectory from the quickstart
application into the test subdirectory of qxjsonrpc, run login.py, then open
login.html in your browser. Username: admin, password: 1234

- Domain access decorator is fixed and a test included.

- Package version information included.

- Small bugfixes.

Features:

 - Supports four type of HTTP transport:
  GET, POST (_data_ and separate variables) and ScriptTransport.

 - Any object can be a service, any method can be easily published
  using decorators.

 - Access control decorators: @public, @domain, @session and @fail.

 - It's possible to implement new access control methods easily,
  such as methods accessible only to administrators, etc.

 - Correct error handling by exception class hierarchy.

 - Session support (requires cookies when using the HTTP transport),
  Session object is automatically passed to the method.

 - Request object is passed to a method if decorated by @request,
  this gives access to all aspects of request handling.

 - Uses python-cjson-1.0.3x or simplejson to encode/decode JSON
  represenation. Extends both of them to transparently handle
  python date and datetime objects.

 - Simple implementation, the package's source code is fully documented
  by docstrings and comments.

- WSGI support.

 - Actively developed and bugfixed. (But very young.) More server
  interfaces are planned (CherryPy, WebStack, etc.).
  Expect more documentation, tests and examples.

 - Supports Python 2.4 and up, tested with 2.5.0.

 Example:

 import math
import qxjsonrpc
import qxjsonrpc.http

 class MyService(object):
    @qxjsonrpc.public
    def getPi(self, *args):
        print 'Called: getPi%r'%(args,)
        return math.pi

 server=qxjsonrpc.http.HTTPServer(debug=True)
server.setService('myservice', MyService())
server.serve_forever()

 Run the script above, then open your browser and navigate to:
 http://127.0.0.1:8000/?id=1&service=myservice&method=getPi

 You will get a valid JSON-RPC response:
{"error": null, "id": 1, "result": 3.14159265359}

 Please report bugs to: python at cx.hu



More information about the Python-announce-list mailing list