From 866c2fe064ed7045a1536b479b5739950ae3e44e Mon Sep 17 00:00:00 2001 From: CounterPillow Date: Tue, 6 May 2014 19:54:43 +0200 Subject: [PATCH] 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. --- overviewer_core/settingsValidators.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/overviewer_core/settingsValidators.py b/overviewer_core/settingsValidators.py index 0279ed7..6b53bee 100644 --- a/overviewer_core/settingsValidators.py +++ b/overviewer_core/settingsValidators.py @@ -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!")