Add: debugging for freezing api call

This commit is contained in:
Peter Surda 2015-09-28 20:22:54 +02:00
parent 9c0b7efda0
commit a2cd3cbfc2

View File

@ -522,15 +522,24 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
data += ']}' data += ']}'
return data return data
elif method == 'getAllSentMessages': elif method == 'getAllSentMessages':
queryreturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent where folder='sent' ORDER BY lastactiontime''') import pprint
try:
queryreturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent where folder='sent' ORDER BY lastactiontime''')
except:
print "Exception in getallSentMessages"
pprint.pprint (queryreturn)
data = '{"sentMessages":[' data = '{"sentMessages":['
for row in queryreturn: if type(queryreturn) is list:
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row for row in queryreturn:
subject = shared.fixPotentiallyInvalidUTF8Data(subject) msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
message = shared.fixPotentiallyInvalidUTF8Data(message) subject = shared.fixPotentiallyInvalidUTF8Data(subject)
if len(data) > 25: message = shared.fixPotentiallyInvalidUTF8Data(message)
data += ',' if len(data) > 25:
data += json.dumps({'msgid':msgid.encode('hex'), 'toAddress':toAddress, 'fromAddress':fromAddress, 'subject':subject.encode('base64'), 'message':message.encode('base64'), 'encodingType':encodingtype, 'lastActionTime':lastactiontime, 'status':status, 'ackData':ackdata.encode('hex')}, indent=4, separators=(',', ': ')) data += ','
data += json.dumps({'msgid':msgid.encode('hex'), 'toAddress':toAddress, 'fromAddress':fromAddress, 'subject':subject.encode('base64'), 'message':message.encode('base64'), 'encodingType':encodingtype, 'lastActionTime':lastactiontime, 'status':status, 'ackData':ackdata.encode('hex')}, indent=4, separators=(',', ': '))
else:
print "queryreturn is not a list"
pprint.pprint (queryreturn)
data += ']}' data += ']}'
return data return data
elif method == 'getAllSentMessageIds' or method == 'getAllSentMessageIDs': elif method == 'getAllSentMessageIds' or method == 'getAllSentMessageIDs':