0

Fix crop validator to avoid trying to alter a tuple

This commit is contained in:
Thomas Lake
2012-11-22 10:22:45 +00:00
committed by Andrew Chin
parent 7ce2e6d280
commit c6d7a6d8fd

View File

@@ -195,12 +195,13 @@ def validateOutputDir(d):
def validateCrop(value): def validateCrop(value):
if len(value) != 4: if len(value) != 4:
raise ValidationException("The value for the 'crop' setting must be a tuple of length 4") raise ValidationException("The value for the 'crop' setting must be a tuple of length 4")
value = tuple(int(x) for x in value) a, b, c, d = tuple(int(x) for x in value)
if value[0] >= value[2]:
value[0],value[2] = value[2],value[0] if a >= c:
if value[1] >= value[3]: a, c = c, a
value[1],value[3] = value[3],value[1] if b >= d:
return value b, d = d, b
return (a, b, c, d)
def validateObserver(observer): def validateObserver(observer):
if all(map(lambda m: hasattr(observer, m), ['start', 'add', 'update', 'finish'])): if all(map(lambda m: hasattr(observer, m), ['start', 'add', 'update', 'finish'])):