diff --git a/netbox/utilities/utils.py b/netbox/utilities/utils.py index 946fe33e4..77b17b756 100644 --- a/netbox/utilities/utils.py +++ b/netbox/utilities/utils.py @@ -1,4 +1,3 @@ -import datetime import decimal from itertools import count, groupby from urllib.parse import urlencode @@ -15,36 +14,6 @@ from netbox.config import get_config from .string import title -def csv_format(data): - """ - Encapsulate any data which contains a comma within double quotes. - """ - csv = [] - for value in data: - - # Represent None or False with empty string - if value is None or value is False: - csv.append('') - continue - - # Convert dates to ISO format - if isinstance(value, (datetime.date, datetime.datetime)): - value = value.isoformat() - - # Force conversion to string first so we can check for any commas - if not isinstance(value, str): - value = '{}'.format(value) - - # Double-quote the value if it contains a comma or line break - if ',' in value or '\n' in value: - value = value.replace('"', '""') # Escape double-quotes - csv.append('"{}"'.format(value)) - else: - csv.append('{}'.format(value)) - - return ','.join(csv) - - def dynamic_import(name): """ Dynamically import a class from an absolute path string