def __call__(self, row): value = self.get(row, self.src) new_value = parse_price(value, self.decimal_separator, self.thousand_separator) self.set(row, self.dst, new_value) return row
def evaluate_price_field(self): """ There has to be a dot or a comma in one of the prices """ is_price = False seperator_found = False total_price = 0 for row in self.data_sample: if "." in row or "," in row: seperator_found = True try: price = parse_price(row) if price > 40000: return False else: total_price += price is_price = True except (ValueError, InvalidOperation), e: price = False if not price: return False