Skip to content

Instantly share code, notes, and snippets.

@jedie
Created February 25, 2011 08:34
Show Gist options
  • Save jedie/843526 to your computer and use it in GitHub Desktop.
Save jedie/843526 to your computer and use it in GitHub Desktop.
class LocalURLValidator(URLValidator):
"""
>>> LocalURLValidator(verify_exists=False)("/a/url/")
>>> LocalURLValidator(verify_exists=True)("not a url!")
Traceback (most recent call last):
...
ValidationError: [u'Enter a valid URL.']
"""
regex = re.compile(
r'(?:/?|[/?]\S+)$', re.IGNORECASE
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment