Skip to content

Commit

Permalink
Fix validator for empty lists (the default value)
Browse files Browse the repository at this point in the history
Whoops.
  • Loading branch information
CounterPillow committed May 9, 2014
1 parent 6d28942 commit 6812cad
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions overviewer_core/settingsValidators.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,18 @@ def validateOptImg(optimizers):
raise ValidationException("What you passed to optimizeimg is not a list. "\
"Make sure you specify them like [foo()], with square brackets.")

for opt, next_opt in zip(optimizers, optimizers[1:]) + [(optimizers[-1], None)]:
if not isinstance(opt, Optimizer):
raise ValidationException("Invalid Optimizer!")

opt.check_availability()

# Check whether the chaining is somewhat sane
if next_opt:
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. "\
"This is most likely pointless, and wastes time.")
if optimizers:
for opt, next_opt in zip(optimizers, optimizers[1:]) + [(optimizers[-1], None)]:
if not isinstance(opt, Optimizer):
raise ValidationException("Invalid Optimizer!")

opt.check_availability()

# Check whether the chaining is somewhat sane
if next_opt:
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. "\
"This is most likely pointless, and wastes time.")

return optimizers

Expand Down

0 comments on commit 6812cad

Please sign in to comment.