Opened 10 years ago

Closed 10 years ago

Last modified 2 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: UI/UX:


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 (3)

comment:1 Changed 10 years ago by jbronn

Owner: changed from Jeremy Dunck to jbronn

comment:2 Changed 10 years ago by jbronn

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 Changed 2 years ago by Tim Graham <timograham@…>

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.

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