Skip to content

Commit

Permalink
Work around and warn if old optimizeimg definition
Browse files Browse the repository at this point in the history
Before someone says this is incorrect because it only ever uses
pngcrush: The old code always used pngcrush and nothing else
anyway. This is absolutely correct and the old behaviour.

I also added a check to make sure it's a list, as some people might
forget the whole list thing.
  • Loading branch information
CounterPillow committed May 6, 2014
1 parent 09477ed commit 866c2fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion overviewer_core/settingsValidators.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ def validateBGColor(color):

def validateOptImg(optimizers):
if isinstance(optimizers, (int, long)):
raise ValidationException("You are using a deprecated method of specifying optimizeimg!")
from optimizeimages import pngcrush
import logging
logging.warning("You're using a deprecated definition of optimizeimg. We'll do what you say for now, but please fix this as soon as possible.")
optimizers = [pngcrush()]
if not isinstance(optimizers, list):
raise ValidationException("optimizeimg is not a list. Make sure you specify them like [foo()], with square brackets.")
for opt in optimizers:
if not isinstance(opt, Optimizer):
raise ValidationException("Invalid Optimizer!")
Expand Down

0 comments on commit 866c2fe

Please sign in to comment.