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_uptodate(path, self.date_update): return False # Download converted chart as png using convertit source = smart_urljoin(rooturl, self.get_elevation_chart_url(language)) convertit_download(source, path, from_type=HttpSVGResponse.content_type, to_type='image/png', headers={'Accept-Language': language}) return True
def test_is_file_uptodate_no_date(self, mock_value): self.assertFalse(is_file_uptodate(self.path, None))