Skip to content

Validators

is_valid_video_url(value, context) ΒΆ

Validate a URL is a valid video URL.

Parameters:

Name Type Description Default
value
required
context
required
Source code in ckanext/video/logic/validators.py
14
15
16
17
18
19
20
21
22
23
24
25
def is_valid_video_url(value, context):
    """
    Validate a URL is a valid video URL.

    :param value:
    :param context:
    """
    for pattern in video_provider_patterns.values():
        if re.search(pattern, value, re.IGNORECASE):
            return value

    raise toolkit.Invalid(toolkit._('URL is not a valid video provider'))