class IndustryLocationChecks(object): """class to hold location checks for an industry""" def __init__(self, **kwargs): self.incompatible = kwargs.get('incompatible', {}) def get_render_tree(self, switch_prefix): result = [] for industry_type, distance in self.incompatible.items(): result.append(LocationCheckIncompatible(industry_type, distance)) for index in range(0, len(result) - 1): result[index].switch_result = switch_prefix + result[index + 1].industry_type return result class LocationCheckIncompatible(object): def __init__(self, industry_type, distance): self.industry_type = industry_type self.distance = distance self.switch_result = 'CB_RESULT_LOCATION_ALLOW' # default result, value may also be id for next switch