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
=== modified file 'txjsonrpc/web/jsonrpc.py'
--- txjsonrpc/web/jsonrpc.py 2012-01-28 01:11:15 +0000
+++ txjsonrpc/web/jsonrpc.py 2014-02-18 13:31:20 +0000
@@ -127,6 +127,9 @@
127 f = jsonrpclib.Fault(self.FAILURE, "can't serialize output")127 f = jsonrpclib.Fault(self.FAILURE, "can't serialize output")
128 s = jsonrpclib.dumps(f, version=version)128 s = jsonrpclib.dumps(f, version=version)
129 request.setHeader("content-length", str(len(s)))129 request.setHeader("content-length", str(len(s)))
130 if vars(self).has_key('additional_http_headers'):
131 for header, value in self.additional_http_headers.items():
132 request.setHeader(str(header), str(value))
130 request.write(s)133 request.write(s)
131 request.finish()134 request.finish()
132135

Subscribers

People subscribed via source and target branches

to all changes: