Opened 10 years ago

Closed 9 years ago

#3241 closed defect (fixed)

[PATCH] Generic RPC model + JSON support

Reported by: Jani Tiainen Owned by: Alec Thomas
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords: patch
Cc: Trac Release: 0.11


This patch adds generic RPC backend with JSON support (follows XMLRPC conventions).

Works only with 0.11

Attachments (1)

generic_rpc_r3887.patch (53.5 KB) - added by Jani Tiainen 10 years ago.
Patch against r3887

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by Jani Tiainen

Attachment: generic_rpc_r3887.patch added

Patch against r3887

comment:1 Changed 10 years ago by Alec Thomas

TBH, these patch is way to big to review. I'd *much* prefer a less intrusive version. The patch on #2251 (excluding the included JSON) looks more reasonable, though I haven't tried it at all.

comment:2 Changed 9 years ago by osimons

Resolution: fixed
Status: newclosed

(In [6065]) 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 :-)

Bumped version.

Closes #2251. Closes #3241. Please create new tickets for issues that follows this change.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Alec Thomas.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.