diff --git a/trytond/protocols/jsonrpc.py b/trytond/protocols/jsonrpc.py index 3390925c64..194c8cb7f4 100644 --- a/trytond/protocols/jsonrpc.py +++ b/trytond/protocols/jsonrpc.py @@ -27,6 +27,10 @@ except ImportError: import json import base64 import encodings +try: + from cStringIO import StringIO +except ImportError: + from StringIO import StringIO def object_hook(dct): @@ -212,12 +216,36 @@ class SimpleJSONRPCRequestHandler(GZipRequestHandlerMixin, return False def send_tryton_url(self, path): - self.send_response(301) + self.send_response(300) hostname = CONFIG['hostname'] or unicode(socket.getfqdn(), 'utf8') hostname = '.'.join(encodings.idna.ToASCII(part) for part in hostname.split('.')) - self.send_header('Location', 'tryton://%s%s' % (hostname, path)) + values = { + 'hostname': hostname, + 'path': path, + } + content = StringIO() + content.write('') + content.write('' % values) + content.write('
This page has moved to ' + '' + 'tryton://%(hostname)s%(path)s.
' % values) + content.write('') + content.write('