#15378 closed (fixed)
geodjango layermapping save method missed an except
| Reported by: | Lucio Asnaghi | Owned by: | jbronn |
|---|---|---|---|
| Component: | GIS | Version: | 1.2 |
| Severity: | Keywords: | layermapping OGR_F_GetGeometryRef | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
If you use layermapping and you get an OGR error in _save method, then it is impossible to continue due to a missed except (thus the strict parameter is useless then):
django.contrib.gis.gdal.error.OGRException: Invalid geometry pointer returned from "OGR_F_GetGeometryRef".
Attachments (3)
Change History (11)
by , 15 years ago
| Attachment: | layermapping.patch added |
|---|
comment:1 by , 15 years ago
| milestone: | → 1.3 |
|---|
comment:2 by , 15 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 15 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
I've confirmed this exists with an invalid shapefile.
comment:4 by , 15 years ago
| Patch needs improvement: | set |
|---|
I'm -1 on the implementation layermapping.patch, as I think the exception should be caught in the methods where it is raised (e.g., in methods that LayerMapping.feature_kwargs() calls), and then caught as a LayerMapError in LayerMapping.save().
However, my patch has implemented tests and includes a shapefile which recreates the issue.
by , 15 years ago
| Attachment: | 15378.2.diff added |
|---|
Now catch OGRException and raise LayerMapError in right place.
add one more except to catch OGR exceptions in layermapping