How to use the urlpath.pathjoin function in urlpath

To help you get started, we’ve selected a few urlpath examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github miracle2k / webassets / src / webassets / filter / cssrewrite / __init__.py View on Github external
targeturl = urlparse.urljoin(self.source_url, url)
                if targeturl.startswith(to_replace):
                    url = "%s%s" % (sub, targeturl[len(to_replace):])
                    # Only apply the first match
                    break

        else:
            # External mode: use ExternalAssets objects
            # to fetch replacements
            if len(self.external):
                # If path is an absolute one, keep it
                if not self._is_abs_url(url):

                    replacement = None

                    file_path = urlpath.pathjoin(self.source_path, url)
                    asset_path = None
                    for external_assets in self.external:
                        # see if our file has a versioned version available
                        try:
                            asset_path = external_assets.versioned_folder(file_path)
                            break
                        except IOError:
                            pass

                    if asset_path is not None:
                        if self.env.url:
                            # see if it's a complete url (rather than a folder)
                            # otherwise we want a relative path in the CSS
                            if self.env.url.startswith('http://')\
                                or self.env.url.startswith('https://')\
                                or self.env.url.startswith('//'):

urlpath

Object-oriented URL from `urllib.parse` and `pathlib`

Python-2.0
Latest version published 2 years ago

Package Health Score

52 / 100
Full package analysis