Commits

Andrew Godwin committed f652ffd Merge

Merged in eligemejor/south/python3 (pull request #139)

Replace import logic for `StringIO` with `utils.py3`

  • Participants
  • Parent commits 6494af8, 1f02466

Comments (0)

Files changed (2)

File south/migration/migrators.py

 import inspect
 import sys
 import traceback
-try:
-    from cStringIO import StringIO # python 2
-except ImportError:
-    from io import StringIO # python 3
 
 from django.core.management import call_command
 from django.core.management.commands import loaddata
 from south.db import DEFAULT_DB_ALIAS
 from south.models import MigrationHistory
 from south.signals import ran_migration
+from south.utils.py3 import StringIO
 
 
 class Migrator(object):

File south/utils/py3.py

     text_type = str
     raw_input = input
 
+    import io
+    StringIO = io.StringIO
+
 else:
     string_types = basestring,
     text_type = unicode
     raw_input = raw_input
 
+    import cStringIO
+    StringIO = cStringIO.StringIO
+
+
 def with_metaclass(meta, base=object):
     """Create a base class with a metaclass."""
     return meta("NewBase", (base,), {})