def sizes(self): """return image sizes""" sizes = { 'default': self.default_size, 'thumbnail': self.thumbnail } for option, value in self.env.config.options('ticket-image'): if option.startswith('size.'): sizes[option.split('.', -1)] = value for size in sizes: try: width, height = [ i.strip() for i in sizes[size].split('x') ] except ValueError: sizes.pop(size) continue dimension = {} for d in 'width', 'height': try: dimension[d] = locals()[d] and int(locals()[d]) or None except: ValueError: sizes.pop(size) continue sizes[size] = dimension