Browse Source

Use six.StringIO/BytesIO instead of StringIO.StringIO

to keep Python 3.x compatibility, use six.StringIO/BytesIO to
replace StringIO.StringIO

StringIO works for unicode
BytesIO works for bytes

Change-Id: I1d4db56dd082916879b851f2d9ac71d17c0db94f
Closes-Bug: #1280100
tags/2014.1.b3
He Yongli 5 years ago
parent
commit
990f151cdc
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      openstack_dashboard/usage/base.py

+ 2
- 2
openstack_dashboard/usage/base.py View File

@@ -16,13 +16,13 @@ from csv import DictWriter  # noqa
16 16
 from csv import writer  # noqa
17 17
 
18 18
 import datetime
19
-from StringIO import StringIO
20 19
 
21 20
 from django.http import HttpResponse  # noqa
22 21
 from django import template as django_template
23 22
 from django.utils import timezone
24 23
 from django.utils.translation import ugettext_lazy as _
25 24
 from django import VERSION  # noqa
25
+import six
26 26
 
27 27
 from horizon import exceptions
28 28
 from horizon import forms
@@ -294,7 +294,7 @@ class CsvDataMixin(object):
294 294
         will be shown in the result file. Optional.
295 295
     """
296 296
     def __init__(self):
297
-        self.out = StringIO()
297
+        self.out = six.StringIO()
298 298
         super(CsvDataMixin, self).__init__()
299 299
         if hasattr(self, "columns"):
300 300
             self.writer = DictWriter(self.out, map(self.encode, self.columns))

Loading…
Cancel
Save