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
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)
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)
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)
def clean_url(self): value = self.cleaned_data.get('url') if not is_valid_url(value): raise forms.ValidationError('Invalid hostname') return value
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 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
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
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