Part of canonical.launchpad.validators
Function | valid_absolute_url | validate an absolute URL. |
Function | valid_builder_url | validate a url for a builder. |
Function | builder_url_validator | Return True if the url is valid, or raise a LaunchpadValidationError |
It looks like this function has been deprecated by canonical.launchpad.interfaces.validation.
We define this as something that can be parsed into a URL that has both a protocol and a network address.
>>> valid_absolute_url('sftp://chinstrap.ubuntu.com/foo/bar') True >>> valid_absolute_url('http://www.example.com') True >>> valid_absolute_url('whatever:/uxample.com/blah') False
# XXX: 2010-04-26, Salgado, bug=570244: This test only works against # python2.6 but we still need to run on python2.5, so we should uncomment # it only when we no longer need to run on 2.5. >>> #valid_absolute_url('whatever://example.com/blah') True
validate a url for a builder.
Builder urls must be http://host/ or http://host:port/ (with or without the trailing slash) only.
>>> valid_builder_url('http://example.com:54321/') True >>> valid_builder_url('http://example.com/foo') False >>> valid_builder_url('ftp://foo.com/') False