2005-07-13 09:25:57 +08:00
|
|
|
import re
|
2006-05-02 09:31:56 +08:00
|
|
|
from django.conf import settings
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
from django.utils.encoding import force_unicode
|
|
|
|
from django.utils.functional import allow_lazy
|
2007-08-15 20:09:32 +08:00
|
|
|
from django.utils.translation import ugettext_lazy
|
2005-12-04 20:06:16 +08:00
|
|
|
|
2005-08-02 05:29:52 +08:00
|
|
|
# Capitalizes the first letter of a string.
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
capfirst = lambda x: x and force_unicode(x)[0].upper() + force_unicode(x)[1:]
|
|
|
|
capfirst = allow_lazy(capfirst, unicode)
|
2005-08-02 05:29:52 +08:00
|
|
|
|
2005-07-13 09:25:57 +08:00
|
|
|
def wrap(text, width):
|
|
|
|
"""
|
|
|
|
A word-wrap function that preserves existing line breaks and most spaces in
|
2006-12-16 03:05:57 +08:00
|
|
|
the text. Expects that existing line breaks are posix newlines.
|
2005-07-13 09:25:57 +08:00
|
|
|
"""
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
text = force_unicode(text)
|
2006-12-16 03:05:57 +08:00
|
|
|
def _generator():
|
|
|
|
it = iter(text.split(' '))
|
|
|
|
word = it.next()
|
|
|
|
yield word
|
|
|
|
pos = len(word) - word.rfind('\n') - 1
|
|
|
|
for word in it:
|
|
|
|
if "\n" in word:
|
2007-03-20 19:07:52 +08:00
|
|
|
lines = word.split('\n')
|
2006-12-16 03:05:57 +08:00
|
|
|
else:
|
|
|
|
lines = (word,)
|
|
|
|
pos += len(lines[0]) + 1
|
|
|
|
if pos > width:
|
|
|
|
yield '\n'
|
|
|
|
pos = len(lines[-1])
|
|
|
|
else:
|
|
|
|
yield ' '
|
|
|
|
if len(lines) > 1:
|
|
|
|
pos = len(lines[-1])
|
|
|
|
yield word
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
return u''.join(_generator())
|
|
|
|
wrap = allow_lazy(wrap, unicode)
|
2005-07-13 09:25:57 +08:00
|
|
|
|
|
|
|
def truncate_words(s, num):
|
|
|
|
"Truncates a string after a certain number of words."
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
s = force_unicode(s)
|
2005-07-13 09:25:57 +08:00
|
|
|
length = int(num)
|
|
|
|
words = s.split()
|
|
|
|
if len(words) > length:
|
|
|
|
words = words[:length]
|
|
|
|
if not words[-1].endswith('...'):
|
|
|
|
words.append('...')
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
return u' '.join(words)
|
|
|
|
truncate_words = allow_lazy(truncate_words, unicode)
|
2005-07-13 09:25:57 +08:00
|
|
|
|
2007-02-10 10:51:27 +08:00
|
|
|
def truncate_html_words(s, num):
|
|
|
|
"""
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
Truncates html to a certain number of words (not counting tags and
|
|
|
|
comments). Closes opened tags if they were correctly closed in the given
|
|
|
|
html.
|
2007-02-10 10:51:27 +08:00
|
|
|
"""
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
s = force_unicode(s)
|
2007-02-10 10:51:27 +08:00
|
|
|
length = int(num)
|
|
|
|
if length <= 0:
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
return u''
|
2007-02-10 10:51:27 +08:00
|
|
|
html4_singlets = ('br', 'col', 'link', 'base', 'img', 'param', 'area', 'hr', 'input')
|
|
|
|
# Set up regular expressions
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
re_words = re.compile(r'&.*?;|<.*?>|(\w[\w-]*)', re.U)
|
2007-02-10 10:51:27 +08:00
|
|
|
re_tag = re.compile(r'<(/)?([^ ]+?)(?: (/)| .*?)?>')
|
|
|
|
# Count non-HTML words and keep note of open tags
|
|
|
|
pos = 0
|
|
|
|
ellipsis_pos = 0
|
|
|
|
words = 0
|
|
|
|
open_tags = []
|
|
|
|
while words <= length:
|
|
|
|
m = re_words.search(s, pos)
|
|
|
|
if not m:
|
|
|
|
# Checked through whole string
|
|
|
|
break
|
|
|
|
pos = m.end(0)
|
|
|
|
if m.group(1):
|
|
|
|
# It's an actual non-HTML word
|
|
|
|
words += 1
|
|
|
|
if words == length:
|
|
|
|
ellipsis_pos = pos
|
|
|
|
continue
|
|
|
|
# Check for tag
|
|
|
|
tag = re_tag.match(m.group(0))
|
|
|
|
if not tag or ellipsis_pos:
|
|
|
|
# Don't worry about non tags or tags after our truncate point
|
|
|
|
continue
|
|
|
|
closing_tag, tagname, self_closing = tag.groups()
|
|
|
|
tagname = tagname.lower() # Element names are always case-insensitive
|
|
|
|
if self_closing or tagname in html4_singlets:
|
|
|
|
pass
|
|
|
|
elif closing_tag:
|
|
|
|
# Check for match in open tags list
|
|
|
|
try:
|
|
|
|
i = open_tags.index(tagname)
|
|
|
|
except ValueError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
# SGML: An end tag closes, back to the matching start tag, all unclosed intervening start tags with omitted end tags
|
|
|
|
open_tags = open_tags[i+1:]
|
|
|
|
else:
|
|
|
|
# Add it to the start of the open tags list
|
|
|
|
open_tags.insert(0, tagname)
|
|
|
|
if words <= length:
|
|
|
|
# Don't try to close tags if we don't need to truncate
|
|
|
|
return s
|
|
|
|
out = s[:ellipsis_pos] + ' ...'
|
|
|
|
# Close any tags still open
|
|
|
|
for tag in open_tags:
|
|
|
|
out += '</%s>' % tag
|
|
|
|
# Return string
|
|
|
|
return out
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
truncate_html_words = allow_lazy(truncate_html_words, unicode)
|
2007-02-10 10:51:27 +08:00
|
|
|
|
2005-07-13 09:25:57 +08:00
|
|
|
def get_valid_filename(s):
|
|
|
|
"""
|
|
|
|
Returns the given string converted to a string that can be used for a clean
|
|
|
|
filename. Specifically, leading and trailing spaces are removed; other
|
|
|
|
spaces are converted to underscores; and all non-filename-safe characters
|
|
|
|
are removed.
|
|
|
|
>>> get_valid_filename("john's portrait in 2004.jpg")
|
|
|
|
'johns_portrait_in_2004.jpg'
|
|
|
|
"""
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
s = force_unicode(s).strip().replace(' ', '_')
|
2005-07-13 09:25:57 +08:00
|
|
|
return re.sub(r'[^-A-Za-z0-9_.]', '', s)
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
get_valid_filename = allow_lazy(get_valid_filename, unicode)
|
2005-07-13 09:25:57 +08:00
|
|
|
|
2007-08-15 20:09:32 +08:00
|
|
|
def get_text_list(list_, last_word=ugettext_lazy(u'or')):
|
2005-07-13 09:25:57 +08:00
|
|
|
"""
|
|
|
|
>>> get_text_list(['a', 'b', 'c', 'd'])
|
|
|
|
'a, b, c or d'
|
|
|
|
>>> get_text_list(['a', 'b', 'c'], 'and')
|
|
|
|
'a, b and c'
|
|
|
|
>>> get_text_list(['a', 'b'], 'and')
|
|
|
|
'a and b'
|
|
|
|
>>> get_text_list(['a'])
|
|
|
|
'a'
|
|
|
|
>>> get_text_list([])
|
|
|
|
''
|
|
|
|
"""
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
if len(list_) == 0: return u''
|
|
|
|
if len(list_) == 1: return force_unicode(list_[0])
|
|
|
|
return u'%s %s %s' % (', '.join([force_unicode(i) for i in list_][:-1]), force_unicode(last_word), force_unicode(list_[-1]))
|
|
|
|
get_text_list = allow_lazy(get_text_list, unicode)
|
2005-07-13 09:25:57 +08:00
|
|
|
|
|
|
|
def normalize_newlines(text):
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
return force_unicode(re.sub(r'\r\n|\r|\n', '\n', text))
|
|
|
|
normalize_newlines = allow_lazy(normalize_newlines, unicode)
|
2005-07-13 09:25:57 +08:00
|
|
|
|
|
|
|
def recapitalize(text):
|
|
|
|
"Recapitalizes text, placing caps after end-of-sentence punctuation."
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
text = force_unicode(text).lower()
|
2005-07-13 09:25:57 +08:00
|
|
|
capsRE = re.compile(r'(?:^|(?<=[\.\?\!] ))([a-z])')
|
|
|
|
text = capsRE.sub(lambda x: x.group(1).upper(), text)
|
|
|
|
return text
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
recapitalize = allow_lazy(recapitalize)
|
2005-07-13 09:25:57 +08:00
|
|
|
|
|
|
|
def phone2numeric(phone):
|
|
|
|
"Converts a phone number with letters into its numeric equivalent."
|
|
|
|
letters = re.compile(r'[A-PR-Y]', re.I)
|
|
|
|
char2number = lambda m: {'a': '2', 'c': '2', 'b': '2', 'e': '3',
|
|
|
|
'd': '3', 'g': '4', 'f': '3', 'i': '4', 'h': '4', 'k': '5',
|
|
|
|
'j': '5', 'm': '6', 'l': '5', 'o': '6', 'n': '6', 'p': '7',
|
|
|
|
's': '7', 'r': '7', 'u': '8', 't': '8', 'w': '9', 'v': '8',
|
|
|
|
'y': '9', 'x': '9'}.get(m.group(0).lower())
|
|
|
|
return letters.sub(char2number, phone)
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
phone2numeric = allow_lazy(phone2numeric)
|
2005-07-19 01:23:04 +08:00
|
|
|
|
|
|
|
# From http://www.xhaus.com/alan/python/httpcomp.html#gzip
|
|
|
|
# Used with permission.
|
|
|
|
def compress_string(s):
|
|
|
|
import cStringIO, gzip
|
|
|
|
zbuf = cStringIO.StringIO()
|
|
|
|
zfile = gzip.GzipFile(mode='wb', compresslevel=6, fileobj=zbuf)
|
|
|
|
zfile.write(s)
|
|
|
|
zfile.close()
|
|
|
|
return zbuf.getvalue()
|
2005-12-04 20:06:16 +08:00
|
|
|
|
|
|
|
ustring_re = re.compile(u"([\u0080-\uffff])")
|
2006-09-22 10:22:58 +08:00
|
|
|
|
|
|
|
def javascript_quote(s, quote_double_quotes=False):
|
2005-12-04 20:06:16 +08:00
|
|
|
|
|
|
|
def fix(match):
|
|
|
|
return r"\u%04x" % ord(match.group(1))
|
|
|
|
|
|
|
|
if type(s) == str:
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
s = s.decode('utf-8')
|
2005-12-04 20:06:16 +08:00
|
|
|
elif type(s) != unicode:
|
|
|
|
raise TypeError, s
|
|
|
|
s = s.replace('\\', '\\\\')
|
2006-09-22 10:22:58 +08:00
|
|
|
s = s.replace('\r', '\\r')
|
2005-12-04 20:06:16 +08:00
|
|
|
s = s.replace('\n', '\\n')
|
|
|
|
s = s.replace('\t', '\\t')
|
|
|
|
s = s.replace("'", "\\'")
|
2006-09-22 10:22:58 +08:00
|
|
|
if quote_double_quotes:
|
|
|
|
s = s.replace('"', '"')
|
2005-12-04 20:06:16 +08:00
|
|
|
return str(ustring_re.sub(fix, s))
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
javascript_quote = allow_lazy(javascript_quote, unicode)
|
2005-12-04 20:06:16 +08:00
|
|
|
|
2006-06-07 14:08:23 +08:00
|
|
|
smart_split_re = re.compile('("(?:[^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'(?:[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'|[^\\s]+)')
|
|
|
|
def smart_split(text):
|
2006-06-08 12:26:23 +08:00
|
|
|
"""
|
|
|
|
Generator that splits a string by spaces, leaving quoted phrases together.
|
|
|
|
Supports both single and double quotes, and supports escaping quotes with
|
|
|
|
backslashes. In the output, strings will keep their initial and trailing
|
|
|
|
quote marks.
|
2007-03-30 19:57:50 +08:00
|
|
|
|
2007-03-30 20:00:38 +08:00
|
|
|
>>> list(smart_split('This is "a person\'s" test.'))
|
|
|
|
['This', 'is', '"a person\'s"', 'test.']
|
2006-06-08 12:26:23 +08:00
|
|
|
"""
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
text = force_unicode(text)
|
2006-06-07 14:08:23 +08:00
|
|
|
for bit in smart_split_re.finditer(text):
|
|
|
|
bit = bit.group(0)
|
2007-03-30 19:57:50 +08:00
|
|
|
if bit[0] == '"' and bit[-1] == '"':
|
2006-06-08 12:26:23 +08:00
|
|
|
yield '"' + bit[1:-1].replace('\\"', '"').replace('\\\\', '\\') + '"'
|
2007-03-30 19:57:50 +08:00
|
|
|
elif bit[0] == "'" and bit[-1] == "'":
|
2006-06-08 12:26:23 +08:00
|
|
|
yield "'" + bit[1:-1].replace("\\'", "'").replace("\\\\", "\\") + "'"
|
2006-06-07 14:08:23 +08:00
|
|
|
else:
|
2006-06-08 12:26:23 +08:00
|
|
|
yield bit
|
Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.
Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 20:11:04 +08:00
|
|
|
smart_split = allow_lazy(smart_split, unicode)
|
|
|
|
|