Merge lp:~gmludo/txjsonrpc/txjsonrpc into lp:txjsonrpc

Proposed by Gasc Ludovic
Status: Merged
Approved by: Duncan McGreggor
Approved revision: 96
Merged at revision: 95
Proposed branch: lp:~gmludo/txjsonrpc/txjsonrpc
Merge into: lp:txjsonrpc
Diff against target: 12 lines (+3/-0)
1 file modified
txjsonrpc/web/jsonrpc.py (+3/-0)
To merge this branch: bzr merge lp:~gmludo/txjsonrpc/txjsonrpc
Reviewer Review Type Date Requested Status
Duncan McGreggor Approve
Review via email: mp+197575@code.launchpad.net

Description of the change

Add additional_http_headers property in JSONRPC to add easily a custom http header, for example with CORS (Access-Control-Allow-Origin).

To post a comment you must log in.
Revision history for this message
Gasc Ludovic (gmludo) wrote :

Somebody could review this patch ?

Thank you.

Revision history for this message
Duncan McGreggor (oubiwann) wrote :

Hey, sorry about that.

One tiny comment: instead of "self.__dict__.has_key", let's do "vars(self).has_key"

Other than that, looks good!

lp:~gmludo/txjsonrpc/txjsonrpc updated
96. By Gasc Ludovic

change self.__dict__ to vars(self)

Revision history for this message
Gasc Ludovic (gmludo) wrote :

It's done.

Revision history for this message
Gasc Ludovic (gmludo) wrote :

Somebody could merge this patch ?

Thank you.

Revision history for this message
Duncan McGreggor (oubiwann) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'txjsonrpc/web/jsonrpc.py'
2--- txjsonrpc/web/jsonrpc.py 2012-01-28 01:11:15 +0000
3+++ txjsonrpc/web/jsonrpc.py 2014-02-18 13:31:20 +0000
4@@ -127,6 +127,9 @@
5 f = jsonrpclib.Fault(self.FAILURE, "can't serialize output")
6 s = jsonrpclib.dumps(f, version=version)
7 request.setHeader("content-length", str(len(s)))
8+ if vars(self).has_key('additional_http_headers'):
9+ for header, value in self.additional_http_headers.items():
10+ request.setHeader(str(header), str(value))
11 request.write(s)
12 request.finish()
13

Subscribers

People subscribed via source and target branches

to all changes: