mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Enhance unicodify to correctly handle non-string input.
This commit is contained in:
@@ -480,10 +480,11 @@ def unicodify( value, encoding=DEFAULT_ENCODING, error='replace', default=None )
|
||||
"""
|
||||
Returns a unicode string or None
|
||||
"""
|
||||
|
||||
if isinstance( value, unicode ):
|
||||
return value
|
||||
try:
|
||||
return unicode( value, encoding, error )
|
||||
return unicode( str( value ), encoding, error )
|
||||
except:
|
||||
return default
|
||||
|
||||
|
||||
Reference in New Issue
Block a user