Merge pull request #453 from willstott101/stringio_six

Use Django's six module for StringIO imports.
This commit is contained in:
Jonathan Barratt 2016-11-17 19:11:37 +07:00 committed by GitHub
commit 73fd081b48
2 changed files with 2 additions and 5 deletions

View File

@ -8,10 +8,7 @@ forms.py - Definitions of newforms-based forms for creating and maintaining
""" """
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
try: from django.utils.six import StringIO
from StringIO import StringIO
except ImportError:
from io import StringIO
from django import forms from django import forms
from django.forms import extras from django.forms import extras

View File

@ -1388,7 +1388,7 @@ class CustomField(models.Model):
) )
def _choices_as_array(self): def _choices_as_array(self):
from StringIO import StringIO from django.utils.six import StringIO
valuebuffer = StringIO(self.list_values) valuebuffer = StringIO(self.list_values)
choices = [[item.strip(), item.strip()] for item in valuebuffer.readlines()] choices = [[item.strip(), item.strip()] for item in valuebuffer.readlines()]
valuebuffer.close() valuebuffer.close()