No need to process an empty string in str_format.ascii_safe()

This commit is contained in:
Chris Mayo 2020-07-08 19:47:59 +01:00
parent 1f77506c9f
commit 7a0644a234

View file

@ -67,7 +67,7 @@ def ascii_safe(s):
@return: version of s containing only ASCII characters, or None if s was None
@rtype: string or None
"""
if s is not None:
if s:
s = s.encode('ascii', 'ignore').decode('ascii')
return s