XmlRpcPlugin: JSON-RPC support. It requires either Python 2.6 (part of standard lib, but untested by me), or easy_install simplejson for 2.4/2.5 (tested).

Building on recent changes with types, all methods are already protocol and type agnostic and work unchanged. Summary of important changes:

With a lot of recent changes to the core of the plugin, I wanted this change to be as unobtrusive as possible. Therefore it just switches on Content-Type header in main handler, leaving XML-RPC and JSON-RPC to doing their own things. At some stage the protocol code will be abstracted using extension-points so that adding protocol handlers can be done more cleanly - including from other plugins.

It tries to conform quite closely to the various versions, drafts and ongoing discussions for the JSON-RPC specification. However, that work is somewhat in flux, so changes may be needed later.

JSON-RPC has no notion of types outside the standard Javascript types that are easily converted to very similar Python types. In order to support 'datetime' and 'binary' at any level in arguments (like a 'due' field in attributes for milestone update), some form of type-hint was needed: {"__jsonclass__": ["binary", "<base64-encoded>"]} is how to specify a binary value (similar structure for 'datetime'). See the new HTML documentation on /xmlrpc or /jsonrpc for details. Custom encoder + decoder handles all conversions.

For the first time in the history of the plugin, the new feature comes complete with unittests that actually shows and verifies that it works. Not bad :-)

XmlRpcPlugin: Implemented a test subsystem, and the start of functional unittests - #5382.

Test subsystem depends on a patch for Trac 0.11-stable (not yet committed - see ​trac:ticket:8388), and Trac needs to be running from source (either installing Trac using python setup.py develop, or adding Trac source to PYTHONPATH when running tests - it reuses Trac functional test infrastructure to create a test project and start a standalone server that answer requests for the duration of the test run.

The test server is available with basic authentication and 3 users (anonymous|user|admin), and any aspect of the plugin should be testable using this infrastructure. Currently it contains just a couple of complicated tests for workflow and security policy plugins, but a long list of plain method->result tests also needs to be added. Patches welcome :-)

This change makes some changes in the displayed set of methods, as the new answer to permissions is "it depends"... It depends on whatever security policies are running on the specific Trac installation. There is therefore new support for specifying None as method permission, but then each method is responsible for checking permissions per resource.

Most important/useful methods now use resource-level permissions, and the method listing and HTML display of API is therefore changed to always list all operative methods. HTML tables is also reformatted to be easier to browse.