Jakob Truelsen
unread,Jun 23, 2009, 8:32:15 AM6/23/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to JSON-RPC
Hello, currently modpythonwraper failes if it cannot convert a string
to ascii, thus unicode string that contains a none ascii charcter
causes rpc calls to fail.
Please consider the following patch:
--- /usr/src/python-jsonrpc/jsonrpc/modpywrapper.py 2009-06-16
12:17:44.083323617 +0200
+++ /usr/local/lib/python2.6/dist-packages/jsonrpc/modpywrapper.py
2009-06-23 14:22:50.475605840 +0200
@@ -1,11 +1,10 @@
import sys, os
from jsonrpc import ServiceHandler, ServiceException
-
+import codecs
class ServiceImplementaionNotFound(ServiceException):
pass
class ModPyServiceHandler(ServiceHandler):
def __init__(self, req):
self.req = req
@@ -41,7 +40,7 @@
self.req.content_type = "text/plain"
data = self.req.read()
resultData = ServiceHandler.handleRequest(self, data)
- self.req.write(resultData)
+ self.req.write(codecs.lookup('utf8').encode
(resultData,'replace')[0])
self.req.flush()
def handler(req):