Opened 16 years ago
Closed 15 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 |
Description
This patch adds generic RPC backend with JSON support (follows XMLRPC conventions).
Works only with 0.11
Attachments (1)
Change History (3)
Changed 16 years ago by
Attachment: | generic_rpc_r3887.patch added |
---|
comment:1 Changed 16 years ago by
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 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(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.
Patch against r3887