#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 |
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 (4)
comment:1 by , 17 years ago
Owner: | changed from | to
---|
comment:2 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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.