Check .isspace() instead of a literal string for speed.
parent
776584bd59
commit
e00597c3ed
|
@ -515,14 +515,14 @@ def _sanitise(*args):
|
||||||
except (AssertionError, ProtectedOption) as error:
|
except (AssertionError, ProtectedOption) as error:
|
||||||
log.warn("_check_option(): %s" % error.message)
|
log.warn("_check_option(): %s" % error.message)
|
||||||
else:
|
else:
|
||||||
safe_option += (flag + " ")
|
safe_option += (flag + ' ')
|
||||||
if (not _util._py3k and isinstance(value, basestring)) \
|
if (not _util._py3k and isinstance(value, basestring)) \
|
||||||
or (_util._py3k and isinstance(value, str)):
|
or (_util._py3k and isinstance(value, str)):
|
||||||
values = value.split(' ')
|
values = value.split(' ')
|
||||||
for v in values:
|
for v in values:
|
||||||
try:
|
try:
|
||||||
assert v is not None
|
assert v is not None
|
||||||
assert v.strip() != ""
|
assert not v.isspace()
|
||||||
except:
|
except:
|
||||||
log.debug("Dropping %s %s" % (flag, v))
|
log.debug("Dropping %s %s" % (flag, v))
|
||||||
continue
|
continue
|
||||||
|
@ -549,7 +549,7 @@ def _sanitise(*args):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
assert v is not None
|
assert v is not None
|
||||||
assert v.strip() != ""
|
assert not v.isspace()
|
||||||
except:
|
except:
|
||||||
log.debug("Dropping %s %s" % (flag, v))
|
log.debug("Dropping %s %s" % (flag, v))
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue