Skip to content

Commit

Permalink
Python3 fix for cStringIO
Browse files Browse the repository at this point in the history
  • Loading branch information
moshthepitt committed Apr 17, 2018
1 parent ee2151a commit cbfb789
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions onadata/libs/utils/common_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Common helper functions
"""
import cStringIO
from io import StringIO
import sys
import traceback
import uuid
Expand Down Expand Up @@ -95,7 +95,7 @@ def get_response_content(response):
"""
contents = u''
if response.streaming:
actual_content = cStringIO.StringIO()
actual_content = StringIO()
for content in response.streaming_content:
actual_content.write(content)
contents = actual_content.getvalue()
Expand Down
6 changes: 3 additions & 3 deletions onadata/libs/utils/csv_import.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cStringIO
from io import StringIO
import json
import sys
import uuid
Expand Down Expand Up @@ -136,7 +136,7 @@ def submit_csv(username, xform, csv_file):
:rtype: Dict
"""
if isinstance(csv_file, unicode):
csv_file = cStringIO.StringIO(csv_file)
csv_file = StringIO(csv_file)
elif csv_file is None or not hasattr(csv_file, 'read'):
return async_status(FAILED, (u'Invalid param type for `csv_file`. '
'Expected utf-8 encoded file or unicode'
Expand Down Expand Up @@ -258,7 +258,7 @@ def submit_csv(username, xform, csv_file):
row_uuid = row.get('meta').get('instanceID')
rollback_uuids.append(row_uuid.replace('uuid:', ''))

xml_file = cStringIO.StringIO(
xml_file = StringIO(
dict2xmlsubmission(row, xform, row_uuid, submission_date))

try:
Expand Down

0 comments on commit cbfb789

Please sign in to comment.