def __readBonus_dossier(bonus, _name, section): blockName, record = section['name'].asString.split(':') operation = 'add' if section.has_key('type'): operation = section['type'].asString if operation not in ('add', 'append', 'set'): raise SoftException('Invalid dossier record %s' % operation) strValue = section['value'].asString value = int(strValue) if strValue not in ('timestamp', ) else strValue unique = False if section.has_key('unique'): unique = section['unique'].asBool dossierType = DOSSIER_TYPE.ACCOUNT if section.has_key('dossierType'): dossierType = section['dossierType'].asInt if dossierType == DOSSIER_TYPE.ACCOUNT: isValid, message = checkAccountDossierOperation( dossierType, blockName, record, operation) if not isValid: raise SoftException('Invalid dossier bonus %s: %s' % (blockName + ':' + record, message)) else: raise SoftException('Dossier type %s not supported in bonus reader' % dossierType) bonus.setdefault('dossier', {}).setdefault(dossierType, {})[blockName, record] = { 'value': value, 'unique': unique, 'type': operation }
def __readBonus_dossier(bonus, _name, section): blockName, record = section['name'].asString.split(':') operation = 'add' if section.has_key('type'): operation = section['type'].asString if operation not in ('add', 'append', 'set'): raise Exception('Invalid dossier record %s' % operation) value = section['value'].asInt unique = False if section.has_key('unique'): unique = section['unique'].asBool dossierType = DOSSIER_TYPE.ACCOUNT if section.has_key('dossierType'): dossierType = section['dossierType'].asInt if dossierType == DOSSIER_TYPE.ACCOUNT: isValid, message = checkAccountDossierOperation(dossierType, blockName, record, operation) if not isValid: raise Exception('Invalid dossier bonus %s: %s' % (blockName + ':' + record, message)) else: raise Exception('Dossier type %s not supported in bonus reader' % dossierType) bonus.setdefault('dossier', {}).setdefault(dossierType, {})[blockName, record] = {'value': value, 'unique': unique, 'type': operation}