fixed bug:
ensure_unicode_string return None if 'string' is type unicode
This commit is contained in:
parent
906c0c0fe2
commit
fd7936ff36
1 changed files with 2 additions and 1 deletions
|
@ -88,7 +88,7 @@ def reduce_chars_newlines(text, max_chars = 0, max_lines = 0,
|
||||||
'''
|
'''
|
||||||
# assure that we have only unicode text
|
# assure that we have only unicode text
|
||||||
text = ensure_unicode_string(text)
|
text = ensure_unicode_string(text)
|
||||||
|
|
||||||
def _cut_if_long(str):
|
def _cut_if_long(str):
|
||||||
if len(str) > max_chars:
|
if len(str) > max_chars:
|
||||||
str = str[:max_chars - 3] + '...'
|
str = str[:max_chars - 3] + '...'
|
||||||
|
@ -125,6 +125,7 @@ def escape_for_pango_markup(string):
|
||||||
def ensure_unicode_string(string):
|
def ensure_unicode_string(string):
|
||||||
if type(string) == str:
|
if type(string) == str:
|
||||||
return unicode(string, encoding = 'utf-8')
|
return unicode(string, encoding = 'utf-8')
|
||||||
|
return string
|
||||||
|
|
||||||
def autodetect_browser_mailer():
|
def autodetect_browser_mailer():
|
||||||
#recognize the environment for appropriate browser/mailer
|
#recognize the environment for appropriate browser/mailer
|
||||||
|
|
Loading…
Add table
Reference in a new issue