Exemplo n.º 1
0
    def clean_custom_ruleset(self):
        # Empty rulesets are okay if we aren't using them. We never
        # allow a ruleset to be stored if it isn't well-formed and
        # valid.
        allow_empty = int(self.data['filter_mode']) != models.FILTER.CUSTOM

        # Use LibCIA to validate the ruleset. It would be nice to
        # hilight errors, or even interactively validate rulesets on
        # the client side.. but this is sufficient for now.
        return models.validate_ruleset(self.cleaned_data['custom_ruleset'], allow_empty)
Exemplo n.º 2
0
    def clean_custom_ruleset(self):
        # Empty rulesets are okay if we aren't using them. We never
        # allow a ruleset to be stored if it isn't well-formed and
        # valid.
        allow_empty = int(self.data['filter_mode']) != models.FILTER.CUSTOM

        # Use LibCIA to validate the ruleset. It would be nice to
        # hilight errors, or even interactively validate rulesets on
        # the client side.. but this is sufficient for now.
        return models.validate_ruleset(self.cleaned_data['custom_ruleset'], allow_empty)
Exemplo n.º 3
0
def ruleset(request):
    from cia.apps.accounts.models import validate_ruleset
    validate_ruleset(request.POST.get('content'))
Exemplo n.º 4
0
def ruleset(request):
    from cia.apps.accounts.models import validate_ruleset
    validate_ruleset(request.POST.get('content'))