def transform_into_absolute_url(config, url): if url.startswith(config.uri): return url url = url.lstrip('/') if url.startswith(config.version): url = urljoin(config.root_uri, url) else: url = urljoin(config.uri, url) return url
def prepend_version(config, url): url = url.lstrip('/') if not url.startswith(config.version): url = urljoin(config.version, url) return url
def uri(self): return urljoin(self.root_uri, self.version)