@@ -1,3 +1,4 @@
|
||||
* Compress RPC responses
|
||||
* Change _changed_values and _save_values properties to method
|
||||
* Add configuration for report convert command
|
||||
* Use process pool to run cron
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import base64
|
||||
import datetime
|
||||
import gzip
|
||||
import json
|
||||
from decimal import Decimal
|
||||
|
||||
@@ -188,6 +189,11 @@ class JSONProtocol:
|
||||
elif isinstance(data, Exception):
|
||||
return InternalServerError(data)
|
||||
response = data
|
||||
return Response(json.dumps(
|
||||
response, cls=JSONEncoder, separators=(',', ':')),
|
||||
content_type='application/json')
|
||||
headers = {}
|
||||
data = json.dumps(
|
||||
response, cls=JSONEncoder, separators=(',', ':'))
|
||||
if len(data) >= 1400 and 'gzip' in request.accept_encodings:
|
||||
data = gzip.compress(data.encode('utf-8'), compresslevel=1)
|
||||
headers['Content-Encoding'] = 'gzip'
|
||||
return Response(
|
||||
data, content_type='application/json', headers=headers)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import datetime
|
||||
import gzip
|
||||
import logging
|
||||
import xmlrpc.client as client
|
||||
# convert decimal to float before marshalling:
|
||||
@@ -166,9 +167,14 @@ class XMLProtocol:
|
||||
data = client.Fault(255, str(data))
|
||||
else:
|
||||
data = (data,)
|
||||
return Response(client.dumps(
|
||||
data, methodresponse=True, allow_none=True),
|
||||
content_type='text/xml')
|
||||
headers = {}
|
||||
data = client.dumps(
|
||||
data, methodresponse=True, allow_none=True)
|
||||
if len(data) >= 1400 and 'gzip' in request.accept_encodings:
|
||||
data = gzip.compress(data.encode('utf-8'), compresslevel=1)
|
||||
headers['Content-Encoding'] = 'gzip'
|
||||
return Response(
|
||||
data, content_type='text/xml', headers=headers)
|
||||
else:
|
||||
if isinstance(data, UserWarning):
|
||||
return Conflict(data)
|
||||
|
||||
Reference in New Issue
Block a user