summaryrefslogtreecommitdiff
path: root/chimere/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/views.py')
-rw-r--r--chimere/views.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/chimere/views.py b/chimere/views.py
index b6c03b8..1e89bd2 100644
--- a/chimere/views.py
+++ b/chimere/views.py
@@ -1017,24 +1017,26 @@ def getTinyfiedUrl(request, parameters, area_name=''):
map_name += " - " + response_dct["area"].name
text = ""
- item_id = parameters.split(';')[4]
- if item_id and "-" in item_id:
- cls = None
- if item_id.startswith('point-'):
- cls = models.Marker
- elif item_id.startswith('route-'):
- cls = models.Route
- elif item_id.startswith('polygon-'):
- cls = models.Polygon
- item_id = item_id.split("-")[1]
- if cls:
- try:
- text = str(cls.objects.get(id=item_id))
- text = str(
- _("Share a point of interest on the map {}: ")
- ).format(map_name) + text
- except (cls.DoesNotExist):
- pass
+ parameter_list = parameters.split(';')
+ if len(parameter_list) >= 5:
+ item_id = parameter_list[4]
+ if item_id and "-" in item_id:
+ cls = None
+ if item_id.startswith('point-'):
+ cls = models.Marker
+ elif item_id.startswith('route-'):
+ cls = models.Route
+ elif item_id.startswith('polygon-'):
+ cls = models.Polygon
+ item_id = item_id.split("-")[1]
+ if cls:
+ try:
+ text = str(cls.objects.get(id=item_id))
+ text = str(
+ _("Share a point of interest on the map {}: ")
+ ).format(map_name) + text
+ except (cls.DoesNotExist):
+ pass
if not text:
text = str(
_("Share a point of interest on the map {}")