Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit f132aae

Browse files
committed
line_protocol: handle py2/py3 difference in _get_unicode().
Fix test_make_lines_unicode() test. _get_unicode() with flag fails under py27 if tag contains unicode.
1 parent 64d03be commit f132aae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

influxdb/line_protocol.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from numbers import Integral
88

99
from dateutil.parser import parse
10-
from six import binary_type, text_type, integer_types
10+
from six import binary_type, text_type, integer_types, PY2
1111

1212

1313
def _convert_timestamp(timestamp, precision=None):
@@ -74,7 +74,10 @@ def _get_unicode(data, force=False):
7474
elif data is None:
7575
return ''
7676
elif force:
77-
return str(data)
77+
if PY2:
78+
return unicode(data)
79+
else:
80+
return str(data)
7881
else:
7982
return data
8083

0 commit comments

Comments
 (0)