99import inspect
1010
1111from django .core .exceptions import ImproperlyConfigured
12+ from django .utils .encoding import force_text
1213from django .conf import settings
1314from django .utils import six
1415import django
1516
1617
17- # Handle django.utils.encoding rename in 1.5 onwards.
18- # smart_unicode -> smart_text
19- # force_unicode -> force_text
20- try :
21- from django .utils .encoding import smart_text
22- except ImportError :
23- from django .utils .encoding import smart_unicode as smart_text
24- try :
25- from django .utils .encoding import force_text
26- except ImportError :
27- from django .utils .encoding import force_unicode as force_text
28-
29-
3018# OrderedDict only available in Python 2.7.
3119# This will always be the case in Django 1.7 and above, as these versions
3220# no longer support Python 2.6.
3321# For Django <= 1.6 and Python 2.6 fall back to OrderedDict.
3422try :
3523 from collections import OrderedDict
36- except :
24+ except ImportError :
3725 from django .utils .datastructures import SortedDict as OrderedDict
3826
3927
@@ -72,21 +60,13 @@ def clean_manytomany_helptext(text):
7260 pass
7361
7462
75- # cStringIO only if it's available, otherwise StringIO
76- try :
77- import cStringIO .StringIO as StringIO
78- except ImportError :
79- StringIO = six .StringIO
80-
81- BytesIO = six .BytesIO
82-
83-
8463# urlparse compat import (Required because it changed in python 3.x)
8564try :
8665 from urllib import parse as urlparse
8766except ImportError :
8867 import urlparse
8968
69+
9070# UserDict moves in Python 3
9171try :
9272 from UserDict import UserDict
@@ -104,14 +84,6 @@ def get_model_name(model_cls):
10484 return model_cls ._meta .module_name
10585
10686
107- def get_concrete_model (model_cls ):
108- try :
109- return model_cls ._meta .concrete_model
110- except AttributeError :
111- # 1.3 does not include concrete model
112- return model_cls
113-
114-
11587# View._allowed_methods only present from 1.5 onwards
11688if django .VERSION >= (1 , 5 ):
11789 from django .views .generic import View
0 commit comments