0

Work around and warn if old optimizeimg definition

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.
This commit is contained in:
CounterPillow
2014-05-06 19:54:43 +02:00
parent 09477ed8a0
commit 866c2fe064

View File

@@ -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!")