コード例 #1
0
ファイル: models.py プロジェクト: adrianmo/Geotrek
 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')
コード例 #2
0
ファイル: models.py プロジェクト: leplatrem/Geotrek
 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')
コード例 #3
0
ファイル: models.py プロジェクト: camillemonchicourt/Geotrek
 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
コード例 #4
0
ファイル: models.py プロジェクト: johan--/Geotrek
 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