"""
return os.path.join(self.basepath, *args)
- def path_to_url(self, path):
+ def url_to(self, url):
"""
- Takes a path to a file on the file system and converts it into a URL
+ Takes a relative URL and makes it absolute
"""
# The base URL
baseurl = self.settings.get("baseurl")
+ # Join it all together
+ return urllib.parse.urljoin(baseurl, url)
+
+ def path_to_url(self, path):
+ """
+ Takes a path to a file on the file system and converts it into a URL
+ """
# Path to package
path = os.path.join(
"files", os.path.relpath(path, self.basepath),
)
- # Join it all together
- return urllib.parse.urljoin(baseurl, path)
+ return self.url_to(path)
def pakfire(self, *args, **kwargs):
"""