I’ve changed that and also was advised on stack overflow to change my data 
field to look like this:

> data: JSON.stringify({method: "breq.getBreqs"})

 

My error message now reads as this:

> Trac[json_rpc] ERROR: RPC(json) decode error
> Traceback (most recent call last):
>   File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 148, in 
> parse_rpc_request
>     data = json.load(req, cls=TracRpcJSONDecoder)
>   File "C:\Python27\Lib\json\__init__.py", line 278, in load
>     **kw)
>   File "C:\Python27\Lib\json\__init__.py", line 339, in loads
>     return cls(encoding=encoding, **kw).decode(s)
>   File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 99, in decode
>     obj = json.JSONDecoder.decode(self, obj, *args, **kwargs)
>   File "C:\Python27\Lib\json\decoder.py", line 369, in decode
>     raise ValueError(errmsg("Extra data", s, end, len(s)))
> ValueError: Extra data: line 1 column 1 - line 1 column 133 (char 1 - 133)
> Trac[web_ui] ERROR: RPC(JSON-RPC) Error
> Traceback (most recent call last):
>   File "build\bdist.win32\egg\tracrpc\web_ui.py", line 143, in _rpc_process
>     rpcreq = req.rpc = protocol.parse_rpc_request(req, content_type)
>   File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 162, in 
> parse_rpc_request
>     raise JsonProtocolException(e, -32700)
> JsonProtocolException: Extra data: line 1 column 1 - line 1 column 133 
> (char 1 - 133)
> Trac[json_rpc] DEBUG: RPC(json) encoded response: {"error": {"message": 
> "JsonProtocolException details : Extra data: line 1 column 1 - line 1 
> column 133 (char 1 - 133)", "code": -32700, "name": "JSONRPCError"}, 
> "result": null, "id": null}
>  
> Trac[main] DEBUG: Dispatching <Request "GET 
> '/chrome/common/trac_logo_mini.png'">
> Trac[main] DEBUG: Dispatching <Request "POST '/jsonrpc'">
> Trac[api] INFO: Synchronized '' repository in 0.00 seconds
> Trac[web_ui] DEBUG: RPC incoming request of content type 
> 'application/json' dispatched to <tracrpc.json_rpc.JsonRpcProtocol object 
> at 0x06BD40D0>
> Trac[web_ui] DEBUG: RPC(JSON-RPC) call by 'PaulWilding'
> Trac[json_rpc] ERROR: RPC(json) decode error
> Traceback (most recent call last):
>   File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 148, in 
> parse_rpc_request
>     data = json.load(req, cls=TracRpcJSONDecoder)
>   File "C:\Python27\Lib\json\__init__.py", line 278, in load
>     **kw)
>   File "C:\Python27\Lib\json\__init__.py", line 339, in loads
>     return cls(encoding=encoding, **kw).decode(s)
>   File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 99, in decode
>     obj = json.JSONDecoder.decode(self, obj, *args, **kwargs)
>   File "C:\Python27\Lib\json\decoder.py", line 369, in decode
>     raise ValueError(errmsg("Extra data", s, end, len(s)))
> ValueError: Extra data: line 1 column 1 - line 1 column 133 (char 1 - 133)
> Trac[web_ui] ERROR: RPC(JSON-RPC) Error
> Traceback (most recent call last):
>   File "build\bdist.win32\egg\tracrpc\web_ui.py", line 143, in _rpc_process
>     rpcreq = req.rpc = protocol.parse_rpc_request(req, content_type)
>   File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 162, in 
> parse_rpc_request
>     raise JsonProtocolException(e, -32700)
> JsonProtocolException: Extra data: line 1 column 1 - line 1 column 133 
> (char 1 - 133)
> Trac[json_rpc] DEBUG: RPC(json) encoded response: {"error": {"message": 
> "JsonProtocolException details : Extra data: line 1 column 1 - line 1 
> column 133 (char 1 - 133)", "code": -32700, "name": "JSONRPCError"}, 
> "result": null, "id": null}

 

I’ve tried logging the request in parse_rpc_request in various ways but no 
output has been produced from this so I haven’t been able to inspect the 
request. I’ve used self.log.debug(str(req)), self.log.debug(json.load(req)) 
and self.log.debug(str(json.load(req))) to try to do this. I don’t know 
whether there’s another way to log this or if you have any idea of what the 
problem might be now?

On Wednesday, July 25, 2012 4:58:58 PM UTC+1, Jun Omae wrote:
>
> Hi, 
>
> On Wed, Jul 25, 2012 at 11:10 PM, paul.wilding 
> <[email protected]> wrote: 
> > Thanks, I've been using this as a loose model and am slowly getting to 
> grips 
> > with how it works. I have a further problem now which I've posted here: 
> > 
> http://stackoverflow.com/questions/11651649/trac-json-rpc-issue-when-using-jquery-ajax
>  
> > 
> > I don't know whether anyone has any ideas for this? 
>
> Please try use `dataType: "json"` instead of "jsonp". 
>
> -- 
> Jun Omae <[email protected]> (大前 潤) 
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/trac-users/-/jcWIllsTdfMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

Reply via email to