Explorar el Código

Removed Python2 hack

Jeremy Stretch hace 7 años
padre
commit
521a989d23
Se han modificado 1 ficheros con 1 adiciones y 12 borrados
  1. 1 12
      netbox/utilities/forms.py

+ 1 - 12
netbox/utilities/forms.py

@@ -2,7 +2,6 @@ import csv
 from io import StringIO
 import json
 import re
-import sys
 
 from django import forms
 from django.conf import settings
@@ -186,11 +185,6 @@ def unpack_grouped_choices(choices):
     return unpacked_choices
 
 
-def utf8_encoder(data):
-    for line in data:
-        yield line.encode('utf-8')
-
-
 #
 # Widgets
 #
@@ -353,12 +347,7 @@ class CSVDataField(forms.CharField):
     def to_python(self, value):
 
         records = []
-
-        # Python 2 hack for Unicode support in the CSV reader
-        if sys.version_info[0] < 3:
-            reader = csv.reader(utf8_encoder(StringIO(value)))
-        else:
-            reader = csv.reader(StringIO(value))
+        reader = csv.reader(StringIO(value))
 
         # Consume and validate the first line of CSV data as column headers
         headers = next(reader)