#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


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

function to_python(self, value) throws uncatched exception OGRException

django module:


source code:

class GeometryField(forms.Field):
    def to_python(self, value):
            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 Changed 16 months ago by bmispelon

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset


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


comment:2 Changed 16 months ago by claudep

  • Resolution set to needsinfo
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top