Skip to content

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

Lines changed: 5 additions & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy