Opened 10 years ago

Closed 10 years ago

#23290 closed Bug (needsinfo)

GeometryField validation does not work

Reported by: lmisek Owned by: nobody
Component: GIS Version: 1.6
Severity: Normal Keywords: gis validation
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

When validating form, (form.is_valid())
field GeometryField failes to validate:

function to_python(self, value) throws uncatched exception OGRException

django module:

django.contrib.gis.forms.fields

source code:

class GeometryField(forms.Field):
    def to_python(self, value):
        (...)
        try:
            value = GEOSGeometry(value)
        except (GEOSException, ValueError, TypeError):
            raise forms.ValidationError(self.error_messages['invalid_geom'], code='invalid_geom')
        (...)

OGRException is raised but not catched, so validation failes.
sample invalid input value:

str: {"type": "Point", "coordinates": [null, 0]}

should OGRException be added to except list?

Change History (2)

comment:1 by Baptiste Mispelon, 10 years ago

Hi,

Do you have a (minimal) example of how to reproduce this (showing the form you're using would be helpful for example)?

Thanks.

comment:2 by Claude Paroz, 10 years ago

Resolution: needsinfo
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top