mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Import unicode_literals
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import six
|
||||
|
||||
|
||||
@@ -10,20 +11,20 @@ def csv_format(data):
|
||||
|
||||
# Represent None or False with empty string
|
||||
if value in [None, False]:
|
||||
csv.append(u'')
|
||||
csv.append('')
|
||||
continue
|
||||
|
||||
# Force conversion to string first so we can check for any commas
|
||||
if not isinstance(value, six.string_types):
|
||||
value = u'{}'.format(value)
|
||||
value = '{}'.format(value)
|
||||
|
||||
# Double-quote the value if it contains a comma
|
||||
if u',' in value:
|
||||
csv.append(u'"{}"'.format(value))
|
||||
if ',' in value:
|
||||
csv.append('"{}"'.format(value))
|
||||
else:
|
||||
csv.append(u'{}'.format(value))
|
||||
csv.append('{}'.format(value))
|
||||
|
||||
return u','.join(csv)
|
||||
return ','.join(csv)
|
||||
|
||||
|
||||
def foreground_color(bg_color):
|
||||
|
||||
Reference in New Issue
Block a user