Opened 17 years ago

Closed 17 years ago

Last modified 7 years ago

#4740 closed (fixed)

[gis] Template broken for Polygon-lists

Reported by: anonymous Owned by: jbronn
Component: GIS Version: other branch
Severity: Keywords: gis, template
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The following snippet works in revision 5394 but not in 5395:

{% for polygon in polygons %}
  {{ polygon.exterior_ring.tuple }}
{% endfor %}

In 5395 I get 'index out of range'. It doesn't actually matter what I try to get from the polygon, and it doesn't actually need to even be a for loop, simple {{ }} results in the same error (while print polygons[0].id works in the view).

Change History (4)

comment:1 by jbronn, 17 years ago

Owner: changed from Jeremy Dunck to jbronn

comment:2 by jbronn, 17 years ago

Resolution: fixed
Status: newclosed

Fixed in r5587. The problem was that Django's template ordering resolves dictionaries first -- and expects a KeyError, AttributeError, or TypeError to be thrown. The getitem routines on OGR and GEOS geometry objects raised an IndexError. Thus, I created a new exception (GOES|OGR)GeometryIndexError which inherits from KeyError and replaced the references to IndexError.

comment:3 by Tim Graham <timograham@…>, 9 years ago

In 197b187:

Fixed #25225 -- Simplified code to remove GEOSIndexError

The test is a regression for refs #4740 to show that the original
fix of GEOSIndexError is no longer needed.

comment:4 by Tim Graham <timograham@…>, 7 years ago

In 9397d3ad:

Fixed #28558 -- Simplified code to remove OGRIndexError.

The test is a regression for refs #4740 to show that the original fix of
OGRIndexError is no longer needed.

This is similar to the removal of GEOSIndexError in

Note: See TracTickets for help on using tickets.
Back to Top