Opened 8 years ago
Last modified 8 years ago
#28105 closed Bug
BaseGeometryWidget.get_context() crashes if attrs contains the name of an existing key — at Version 1
Reported by: | Dylan Verheul | Owned by: | nobody |
---|---|---|---|
Component: | GIS | Version: | 1.11 |
Severity: | Release blocker | Keywords: | gis, forms, widgets |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
Incontrib.gis.forms.widgets
there is this part (line 67 in current master):
context = self.build_attrs(self.attrs, dict( name=name, module='geodjango_%s' % name.replace('-', '_'), # JS-safe serialized=self.serialize(value), geom_type=gdal.OGRGeomType(self.attrs['geom_type']), STATIC_URL=settings.STATIC_URL, LANGUAGE_BIDI=translation.get_language_bidi(), **attrs ))
If attrs
also contains a key 'geom_type' this leads to an inevitable crash.
This should probaly be something like:
context_kwargs = attrs.copy() context_kwargs.update(dict( name=name, module='geodjango_%s' % name.replace('-', '_'), # JS-safe serialized=self.serialize(value), geom_type=gdal.OGRGeomType(self.attrs['geom_type']), STATIC_URL=settings.STATIC_URL, LANGUAGE_BIDI=translation.get_language_bidi(), ))
Currently this causes django-bootstrap3 to fail for Django 1.11.
Change History (1)
comment:1 by , 8 years ago
Component: | Forms → GIS |
---|---|
Description: | modified (diff) |
Severity: | Normal → Release blocker |
Summary: | Missing check in django.contrib.forms.widgets → BaseGeometryWidget.get_context() crashes if attrs contains the name of an existing key |
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
Could you explain more about the use case that causes the crash? If you could write a test for
tests/gis_tests/test_geoforms.py
, that would be ideal.