2
2
from django .template import Lexer , TOKEN_TEXT , TOKEN_VAR , TOKEN_BLOCK
3
3
from django .utils .translation .trans_real import (
4
4
inline_re , block_re , endblock_re , plural_re , constant_re )
5
- from django .utils .encoding import smart_unicode
5
+ from django .utils .encoding import smart_text
6
6
7
7
8
8
def extract_django (fileobj , keywords , comment_tags , options ):
@@ -38,14 +38,14 @@ def extract_django(fileobj, keywords, comment_tags, options):
38
38
yield (
39
39
lineno ,
40
40
'ngettext' ,
41
- (smart_unicode (u'' .join (singular )),
42
- smart_unicode (u'' .join (plural ))),
41
+ (smart_text (u'' .join (singular )),
42
+ smart_text (u'' .join (plural ))),
43
43
[])
44
44
else :
45
45
yield (
46
46
lineno ,
47
47
None ,
48
- smart_unicode (u'' .join (singular )),
48
+ smart_text (u'' .join (singular )),
49
49
[])
50
50
51
51
intrans = False
@@ -78,22 +78,22 @@ def extract_django(fileobj, keywords, comment_tags, options):
78
78
g = g .strip ('"' )
79
79
elif g [0 ] == "'" :
80
80
g = g .strip ("'" )
81
- yield lineno , None , smart_unicode (g ), []
81
+ yield lineno , None , smart_text (g ), []
82
82
elif bmatch :
83
83
for fmatch in constant_re .findall (t .contents ):
84
- yield lineno , None , smart_unicode (fmatch ), []
84
+ yield lineno , None , smart_text (fmatch ), []
85
85
intrans = True
86
86
inplural = False
87
87
singular = []
88
88
plural = []
89
89
elif cmatches :
90
90
for cmatch in cmatches :
91
- yield lineno , None , smart_unicode (cmatch ), []
91
+ yield lineno , None , smart_text (cmatch ), []
92
92
elif t .token_type == TOKEN_VAR :
93
93
parts = t .contents .split ('|' )
94
94
cmatch = constant_re .match (parts [0 ])
95
95
if cmatch :
96
- yield lineno , None , smart_unicode (cmatch .group (1 )), []
96
+ yield lineno , None , smart_text (cmatch .group (1 )), []
97
97
for p in parts [1 :]:
98
98
if p .find (':_(' ) >= 0 :
99
99
p1 = p .split (':' , 1 )[1 ]
@@ -105,4 +105,4 @@ def extract_django(fileobj, keywords, comment_tags, options):
105
105
p1 = p1 .strip ("'" )
106
106
elif p1 [0 ] == '"' :
107
107
p1 = p1 .strip ('"' )
108
- yield lineno , None , smart_unicode (p1 ), []
108
+ yield lineno , None , smart_text (p1 ), []
0 commit comments