• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LeanderCS / flask-inputfilter / #132

09 Mar 2025 10:59AM UTC coverage: 91.233% (-6.7%) from 97.948%
#132

push

coveralls-python

LeanderCS
Add google analytics

0 of 104 new or added lines in 8 files covered. (0.0%)

1384 of 1517 relevant lines covered (91.23%)

0.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/flask_inputfilter/Validator/IsHtmlValidator.py
NEW
1
import re
×
NEW
2
from typing import Any, Optional
×
3

NEW
4
from flask_inputfilter.Exception import ValidationError
×
NEW
5
from flask_inputfilter.Validator import BaseValidator
×
6

7

NEW
8
class IsHtmlValidator(BaseValidator):
×
9
    """
10
    Validator that checks if a value contains valid HTML.
11
    """
12

NEW
13
    def __init__(self, error_message: Optional[str] = None) -> None:
×
NEW
14
        self.error_message = (
×
15
            error_message or "Value does not contain valid HTML."
16
        )
17

NEW
18
    def validate(self, value: Any) -> None:
×
NEW
19
        if not isinstance(value, str):
×
NEW
20
            raise ValidationError("Value must be a string.")
×
21

NEW
22
        if not re.search(r"<\s*\w+.*?>", value):
×
NEW
23
            raise ValidationError(self.error_message)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc