예제 #1
0
def URLValidator(value, **kwargs):
    from sentry.http import is_valid_url  # Django 1.9 setup issue
    if not value.startswith(('http://', 'https://')):
        raise PluginError('Not a valid URL.')
    if not is_valid_url(value):
        raise PluginError('Not a valid URL.')
    return value
예제 #2
0
def validate_urls(value, **kwargs):
    from sentry.http import is_valid_url  # Django 1.9 setup issue
    urls = split_urls(value)
    if any((not u.startswith(('http://', 'https://')) or not is_valid_url(u))
           for u in urls):
        raise PluginError('Not a valid URL.')
    return '\n'.join(urls)
예제 #3
0
def validate_urls4(value, **kwargs):
    output = []
    for url in value.split("\n"):
        url = url.strip()
        if not url:
            continue
        if not url.startswith(("http://", "https://")):
            raise PluginError("Not a valid URL.")
        if not is_valid_url(url):
            raise PluginError("Not a valid URL.")
        output.append(url)
    return "\n".join(output)
예제 #4
0
def validate_urls(value, **kwargs):
    output = []
    for url in value.split('\n'):
        url = url.strip()
        if not url:
            continue
        if not url.startswith(('http://', 'https://')):
            raise PluginError('Not a valid URL.')
        if not is_valid_url(url):
            raise PluginError('Not a valid URL.')
        output.append(url)
    return '\n'.join(output)
예제 #5
0
 def clean_url(self):
     value = self.cleaned_data.get('url')
     if not is_valid_url(value):
         raise forms.ValidationError('Invalid hostname')
     return value
예제 #6
0
def validate_urls(value, **kwargs):
    urls = split_urls(value)
    if any((not u.startswith(("http://", "https://")) or not is_valid_url(u))
           for u in urls):
        raise PluginError("Not a valid URL.")
    return "\n".join(urls)
예제 #7
0
 def clean_url(self):
     value = self.cleaned_data.get('url')
     if not is_valid_url(value):
         raise forms.ValidationError('Invalid hostname')
     return value
예제 #8
0
def validate_urls(value, **kwargs):
    urls = split_urls(value)
    if any((not u.startswith(('http://', 'https://')) or not is_valid_url(u))
           for u in urls):
        raise PluginError('Not a valid URL.')
    return '\n'.join(urls)
예제 #9
0
파일: plugin.py 프로젝트: getsentry/sentry
def validate_urls(value, **kwargs):
    urls = split_urls(value)
    if any((not u.startswith(('http://', 'https://')) or not is_valid_url(u)) for u in urls):
        raise PluginError('Not a valid URL.')
    return '\n'.join(urls)
def URLValidator(value, **kwargs):
    if not value.startswith(('http://', 'https://')):
        raise PluginError('Not a valid URL.')
    if not is_valid_url(value):
        raise PluginError('Not a valid URL.')
    return value
예제 #11
0
def validate_url(url, **kwargs):
    if (not url.startswith(("http://", "https://")) or not is_valid_url(url)):
        raise PluginError("The {} is not a valid URL.".format(url))
    return url
예제 #12
0
def URLValidator(value, **kwargs):
    if not value.startswith(("http://", "https://")):
        raise PluginError("Not a valid URL.")
    if not is_valid_url(value):
        raise PluginError("Not a valid URL.")
    return value