Skip to content

Commit

Permalink
delete unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos committed Nov 15, 2023
1 parent b4ac5a1 commit aebd47a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion geotrek/altimetry/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_elevation_chart_path(self, language=None):
os.mkdir(basefolder)
return os.path.join(basefolder, '%s-%s-%s.png' % (self._meta.model_name, self.pk, language))

def prepare_elevation_chart(self, language, rooturl):
def prepare_elevation_chart(self, language):
"""Converts SVG elevation URI to PNG on disk.
"""
path = self.get_elevation_chart_path(language)
Expand Down
2 changes: 1 addition & 1 deletion geotrek/altimetry/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def serve_elevation_chart(request, model_name, pk, from_command=False):
if not request.user.has_perm('%s.read_%s' % (model._meta.app_label, model_name)):
raise PermissionDenied
language = request.LANGUAGE_CODE
obj.prepare_elevation_chart(language, request.build_absolute_uri('/'))
obj.prepare_elevation_chart(language)
path = obj.get_elevation_chart_path(language).replace(settings.MEDIA_ROOT, '').lstrip('/')

if settings.DEBUG or from_command:
Expand Down
4 changes: 2 additions & 2 deletions geotrek/api/management/commands/sync_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def sync_trek_by_pk_media(self, trek):
self.sync_media_file(desk.resized_picture, prefix=trek.pk, directory=url_trek,
zipfile=trekid_zipfile)
for lang in self.languages:
trek.prepare_elevation_chart(lang, self.referer)
trek.prepare_elevation_chart(lang)
url_media = '/{}{}'.format(trek.pk, settings.MEDIA_URL)
self.sync_file(trek.get_elevation_chart_url_png(lang), settings.MEDIA_ROOT,
url_media, directory=url_trek, zipfile=trekid_zipfile)
Expand All @@ -330,7 +330,7 @@ def sync_trek_by_pk_media(self, trek):
for desk in child.information_desks.all().annotate(geom_type=GeometryType("geom")).filter(geom_type="POINT"):
self.sync_media_file(desk.resized_picture, prefix=trek.pk, directory=url_trek, zipfile=trekid_zipfile)
for lang in self.languages:
child.prepare_elevation_chart(lang, self.referer)
child.prepare_elevation_chart(lang)
url_media = '/{}{}'.format(trek.pk, settings.MEDIA_URL)
self.sync_file(child.get_elevation_chart_url_png(lang), settings.MEDIA_ROOT,
url_media, directory=url_trek, zipfile=trekid_zipfile)
Expand Down
2 changes: 1 addition & 1 deletion geotrek/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class PathDocument(MapEntityDocument):

def get_context_data(self, *args, **kwargs):
language = self.request.LANGUAGE_CODE
self.get_object().prepare_elevation_chart(language, self.request.build_absolute_uri('/'))
self.get_object().prepare_elevation_chart(language)

Check warning on line 119 in geotrek/core/views.py

View check run for this annotation

Codecov / codecov/patch

geotrek/core/views.py#L119

Added line #L119 was not covered by tests
return super().get_context_data(*args, **kwargs)


Expand Down
2 changes: 1 addition & 1 deletion geotrek/trekking/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def render_to_response(self, context, **response_kwargs):
# Prepare altimetric graph
trek = self.get_object()
language = self.request.LANGUAGE_CODE
trek.prepare_elevation_chart(language, self.request.build_absolute_uri('/'))
trek.prepare_elevation_chart(language)
return super().render_to_response(context, **response_kwargs)


Expand Down

0 comments on commit aebd47a

Please sign in to comment.