We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I use Python 2.7 and try these two codes with the last version of pyramid_rpc:
from wsgiref.simple_server import make_server from pyramid.config import Configurator from pyramid_rpc.xmlrpc import xmlrpc_method
def say_hello(request, name): return 'Hello, %s' % name
if name == 'main': config = Configurator() config.include('pyramid_rpc.xmlrpc') config.add_xmlrpc_endpoint('xmlrpc', '/xmlrpc') config.add_xmlrpc_method(say_hello, endpoint='xmlrpc', method='say_hello')
app = config.make_wsgi_app() server = make_server('0.0.0.0', 6543, app) server.serve_forever()
import xmlrpclib
proxy = xmlrpclib.ServerProxy('http://localhost:6543/xmlrpc') print proxy.say_hello(u'Sébastien')
And, it raises an exception: xmlrpclib.Fault: <Fault -32500: 'application error'>.
If I change line 79 of xmlrpc.py from:
response.body = ( xmlrpclib.dumps( (result,), methodresponse=True ).encode(response.charset)
to:
response.body = ( xmlrpclib.dumps( (result,), methodresponse=True )
it works perfectly.
I have tried the new code on more complex calls and it always works.
The text was updated successfully, but these errors were encountered:
Ok I managed to reproduce this
def test_nonascii_request(self): def view(request, a, b): return {'a': a, 'b': b} config = self.config config.include('pyramid_rpc.xmlrpc') config.add_xmlrpc_endpoint('rpc', '/api/xmlrpc') config.add_xmlrpc_method(view, endpoint='rpc', method='dummy') app = config.make_wsgi_app() app = TestApp(app) val = 'S\xc3\xa9bastien'.decode('utf-8') resp = self._callFUT(app, 'dummy', (2, val)) self.assertEqual(resp, {'a': 2, 'b': val})
Sorry, something went wrong.
cc1f8ed
No branches or pull requests
I use Python 2.7 and try these two codes with the last version of pyramid_rpc:
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid_rpc.xmlrpc import xmlrpc_method
def say_hello(request, name):
return 'Hello, %s' % name
if name == 'main':
config = Configurator()
config.include('pyramid_rpc.xmlrpc')
config.add_xmlrpc_endpoint('xmlrpc', '/xmlrpc')
config.add_xmlrpc_method(say_hello, endpoint='xmlrpc', method='say_hello')
-- coding: utf-8 --
import xmlrpclib
proxy = xmlrpclib.ServerProxy('http://localhost:6543/xmlrpc')
print proxy.say_hello(u'Sébastien')
And, it raises an exception: xmlrpclib.Fault: <Fault -32500: 'application error'>.
If I change line 79 of xmlrpc.py from:
to:
it works perfectly.
I have tried the new code on more complex calls and it always works.
The text was updated successfully, but these errors were encountered: