Opened 8 years ago

Closed 8 years ago

Last modified 9 days 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:

Description

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 {{ polygons.0.id }} results in the same error (while print polygons[0].id works in the view).

Change History (3)

comment:1 Changed 8 years ago by jbronn

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from jdunck to jbronn
  • Patch needs improvement unset

comment:2 Changed 8 years ago by jbronn

  • Resolution set to fixed
  • Status changed from new to closed

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 9 days 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