def __validate_specials_map(self, conf_obj): if SPECIALS_MAP not in conf_obj: conf_obj[SPECIALS_MAP] = dict() return if isinstance(conf_obj[SPECIALS_MAP], str) and conf_obj[SPECIALS_MAP].lower() == 'none': conf_obj[SPECIALS_MAP] = dict() return if not conf_obj[SPECIALS_MAP]: return addr_validator = AddressValidator(SPECIALS_MAP) for key, value in conf_obj[SPECIALS_MAP].items(): addr_validator.validate(key) FeeValidator("specials_map:" + key).validate(value)
def onspecials(input): if not input: fsm.go() return try: address_target = input.split(',') address = address_target[0].strip() fee = float(address_target[1].strip()) AddressValidator("special address").validate(address) FeeValidator("special_fee").validate(fee) global parser conf_obj = parser.get_conf_obj() if SPECIALS_MAP not in conf_obj: conf_obj[SPECIALS_MAP] = dict() conf_obj[SPECIALS_MAP][address] = fee parser.validate_specials_map(parser.get_conf_obj()) except Exception: printe("Invalid specials entry: " + traceback.format_exc()) return
def validate_service_fee(self, conf_obj): if SERVICE_FEE not in conf_obj: raise ConfigurationException("Service fee is not set") FeeValidator(SERVICE_FEE).validate(conf_obj[(SERVICE_FEE)])