0

Fix validator for empty lists (the default value)

Whoops.
This commit is contained in:
CounterPillow
2014-05-09 16:58:47 +02:00
parent 6d28942626
commit 6812cad596

View File

@@ -167,17 +167,18 @@ def validateOptImg(optimizers):
raise ValidationException("What you passed to optimizeimg is not a list. "\ raise ValidationException("What you passed to optimizeimg is not a list. "\
"Make sure you specify them like [foo()], with square brackets.") "Make sure you specify them like [foo()], with square brackets.")
for opt, next_opt in zip(optimizers, optimizers[1:]) + [(optimizers[-1], None)]: if optimizers:
if not isinstance(opt, Optimizer): for opt, next_opt in zip(optimizers, optimizers[1:]) + [(optimizers[-1], None)]:
raise ValidationException("Invalid Optimizer!") if not isinstance(opt, Optimizer):
raise ValidationException("Invalid Optimizer!")
opt.check_availability() opt.check_availability()
# Check whether the chaining is somewhat sane # Check whether the chaining is somewhat sane
if next_opt: if next_opt:
if opt.is_crusher() and not next_opt.is_crusher(): if opt.is_crusher() and not next_opt.is_crusher():
logging.warning("You're feeding a crushed output into an optimizer that does not crush. "\ logging.warning("You're feeding a crushed output into an optimizer that does not crush. "\
"This is most likely pointless, and wastes time.") "This is most likely pointless, and wastes time.")
return optimizers return optimizers