Esempio n. 1
0
def change_rule_value(rule, value):
    """
  Update the value of an existing rule.
  """
    query = (RepoMirrorRule.update(rule_value=value).where(
        RepoMirrorRule.id == rule.id))
    return query.execute()
Esempio n. 2
0
def change_rule(repository, rule_type, rule_value):
    """
    Update the value of an existing rule.
    """

    validate_rule(rule_type, rule_value)

    mirrorRule = get_root_rule(repository)
    if not mirrorRule:
        raise ValidationError("validation failed: rule not found")

    query = RepoMirrorRule.update(rule_value=rule_value).where(RepoMirrorRule.id == mirrorRule.id)
    return query.execute()