def render_media(self, context, spec, output, indent=4): categories = self.categories or spec.keys() result = [] for f in compile_file_list(spec, *categories): result.append(output % urlparse.urljoin(settings.MEDIA_URL, f)) # Join each line with a newline and the requested number of indent spaces return ('\n%s' % (' ' * indent)).join(result)
def _get_media_urls(spec, keys): """Returns the URLs to the media files in the passed spec with the passed keys.""" return [urlparse.urljoin(settings.MEDIA_URL, p) for p in compile_file_list(spec, *keys)]