示例#1
0
文件: bots.py 项目: Justasic/cia-vc
    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)
示例#2
0
def ruleset(request):
    from cia.apps.accounts.models import validate_ruleset
    validate_ruleset(request.POST.get('content'))