9
9
import inspect
10
10
11
11
from django .core .exceptions import ImproperlyConfigured
12
+ from django .utils .encoding import force_text
12
13
from django .conf import settings
13
14
from django .utils import six
14
15
import django
15
16
16
17
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
-
30
18
# OrderedDict only available in Python 2.7.
31
19
# This will always be the case in Django 1.7 and above, as these versions
32
20
# no longer support Python 2.6.
33
21
# For Django <= 1.6 and Python 2.6 fall back to OrderedDict.
34
22
try :
35
23
from collections import OrderedDict
36
- except :
24
+ except ImportError :
37
25
from django .utils .datastructures import SortedDict as OrderedDict
38
26
39
27
@@ -72,21 +60,13 @@ def clean_manytomany_helptext(text):
72
60
pass
73
61
74
62
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
-
84
63
# urlparse compat import (Required because it changed in python 3.x)
85
64
try :
86
65
from urllib import parse as urlparse
87
66
except ImportError :
88
67
import urlparse
89
68
69
+
90
70
# UserDict moves in Python 3
91
71
try :
92
72
from UserDict import UserDict
@@ -104,14 +84,6 @@ def get_model_name(model_cls):
104
84
return model_cls ._meta .module_name
105
85
106
86
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
-
115
87
# View._allowed_methods only present from 1.5 onwards
116
88
if django .VERSION >= (1 , 5 ):
117
89
from django .views .generic import View
0 commit comments