diff --git a/confluent_client/confluent/tlvdata.py b/confluent_client/confluent/tlvdata.py index 9676a35a..93332a48 100644 --- a/confluent_client/confluent/tlvdata.py +++ b/confluent_client/confluent/tlvdata.py @@ -16,6 +16,7 @@ # limitations under the License. import confluent.tlv as tlv +from datetime import datetime import json import struct @@ -34,6 +35,8 @@ def unicode_dictvalues(dictdata): for key in dictdata: if isinstance(dictdata[key], str): dictdata[key] = decodestr(dictdata[key]) + elif isinstance(dictdata[key], datetime): + dictdata[key] = dictdata[key].strftime('%Y-%m-%dT%H:%M:%S') elif isinstance(dictdata[key], list): for i in xrange(len(dictdata[key])): if isinstance(dictdata[key][i], str): diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index 895c9782..27a684a3 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -19,6 +19,7 @@ # Things are defined here to 'encourage' developers to coordinate information # format. This is also how different data formats are supported import confluent.exceptions as exc +from datetime import datetime import json valid_health_values = set([ @@ -36,6 +37,8 @@ def _htmlify_structure(indict): ret += "
  • {0}: ".format(key) if type(indict[key]) in (str, unicode, float, int): ret += str(indict[key]) + elif isinstance(indict[key], datetime): + ret += indict[key].strftime('%Y-%m-%dT%H:%M:%S') else: ret += _htmlify_structure(indict[key]) elif isinstance(indict, list):