def prepare_elevation_chart(self, request): """Converts SVG elevation URI to PNG on disk. """ from .views import HttpSVGResponse path = self.get_elevation_chart_path() # Do nothing if image is up-to-date if is_file_newer(path, self.date_update): return # Download converted chart as png using convertit source = request.build_absolute_uri(self.get_elevation_chart_url()) convertit_download(source, path, from_type=HttpSVGResponse.content_type, to_type='image/png')
def prepare_elevation_chart(self, request): """Converts SVG elevation URI to PNG on disk. """ from .views import HttpSVGResponse path = self.get_elevation_chart_path() # Do nothing if image is up-to-date if is_file_newer(path, self.date_update): return # Download converted chart as png using convertit convertit_download(request, self.get_elevation_chart_url(), path, from_type=HttpSVGResponse.content_type, to_type='image/png')
def prepare_elevation_chart(self, rooturl): """Converts SVG elevation URI to PNG on disk. """ from .views import HttpSVGResponse path = self.get_elevation_chart_path() # Do nothing if image is up-to-date if is_file_newer(path, self.date_update): return False # Download converted chart as png using convertit source = smart_urljoin(rooturl, self.get_elevation_chart_url()) convertit_download(source, path, from_type=HttpSVGResponse.content_type, to_type='image/png') return True
def prepare_elevation_chart(self, language, rooturl): """Converts SVG elevation URI to PNG on disk. """ from .views import HttpSVGResponse path = self.get_elevation_chart_path(language) # Do nothing if image is up-to-date if is_file_newer(path, self.date_update): return False # Download converted chart as png using convertit source = smart_urljoin(rooturl, self.get_elevation_chart_url()) convertit_download(source, path, from_type=HttpSVGResponse.content_type, to_type='image/png', headers={'Accept-Language': language}) return True