[Django] #28039: KeyError 'widget' in BaseGeometryWidget

27 views
Skip to first unread message

Django

unread,
Apr 6, 2017, 10:20:34 AM4/6/17
to django-...@googlegroups.com
#28039: KeyError 'widget' in BaseGeometryWidget
------------------------------------------+------------------------
Reporter: Dariusz Paluch | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
BaseGeometryWidget get_context doesn't execute super().get_context(self,
name, value, attrs) so key 'widget' used by method subwidgets doesn't
exists.

--
Ticket URL: <https://code.djangoproject.com/ticket/28039>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 6, 2017, 10:25:12 AM4/6/17
to django-...@googlegroups.com
#28039: KeyError 'widget' in BaseGeometryWidget
--------------------------------+--------------------------------------

Reporter: Dariusz Paluch | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------

Comment (by Tim Graham):

Can you provide a test case to reproduce the issue?

--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:1>

Django

unread,
Apr 6, 2017, 10:32:12 AM4/6/17
to django-...@googlegroups.com
#28039: KeyError 'widget' in BaseGeometryWidget
--------------------------------+--------------------------------------

Reporter: Dariusz Paluch | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.11
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------

Comment (by Dariusz Paluch):

Replying to [comment:1 Tim Graham]:


> Can you provide a test case to reproduce the issue?

Just use any BaseGeometryWidget based form field in form.

--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:2>

Django

unread,
Apr 6, 2017, 1:48:16 PM4/6/17
to django-...@googlegroups.com
#28039: BaseGeometryWidget.subwidgets() crashes with KeyError 'widget'
---------------------------------+------------------------------------

Reporter: Dariusz Paluch | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham):

* component: Forms => GIS
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

Here's a snippet to reproduce:
{{{
>>> from django.contrib.gis.forms import OpenLayersWidget
>>> widget = forms.OpenLayersWidget()
>>> list(widget.subwidgets('name', 'value'))
Traceback (most recent call last):
...
File "django/django/forms/widgets.py", line 177, in subwidgets
yield context['widget']
KeyError: 'widget
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:3>

Django

unread,
Apr 10, 2017, 12:25:57 PM4/10/17
to django-...@googlegroups.com
#28039: BaseGeometryWidget.subwidgets() crashes with KeyError 'widget'
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1


Old description:

> BaseGeometryWidget get_context doesn't execute super().get_context(self,
> name, value, attrs) so key 'widget' used by method subwidgets doesn't
> exists.

New description:

`BaseGeometryWidget.get_context()` doesn't execute


`super().get_context(self, name, value, attrs)` so key `'widget'` used by

method `subwidgets()` doesn't exist.

--

Comment:

Dariusz, could you your application with this
[https://github.com/django/django/pull/8343 PR]. I'm not certain that it's
correct.

--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:4>

Django

unread,
Apr 20, 2017, 8:29:20 AM4/20/17
to django-...@googlegroups.com
#28039: BaseGeometryWidget.subwidgets() crashes with KeyError 'widget'
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by dpaluch-rp):

Replying to [comment:4 Tim Graham]:


> Dariusz, could you your application with this
[https://github.com/django/django/pull/8343 PR]. I'm not certain that it's
correct.

I'm fixed my application the same way.

```class GoogleMapWidget(forms.BaseGeometryWidget):

map_width = 800
map_height = 500
template_name = 'gis/google.html'

def serialize(self, value):
return value.geojson if value else ''

def get_context(self, name, value, attrs):
# TODO: Bug Django 1.11, BaseGeometryWidget.get_context don't call
super(), so context don't have "widget" key
context = super().get_context(name, value, attrs)
super_context = super(forms.BaseGeometryWidget,
self).get_context(name, value, attrs)
super_context.update(context)
return super_context
```

--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:5>

Django

unread,
Apr 20, 2017, 11:36:48 AM4/20/17
to django-...@googlegroups.com
#28039: BaseGeometryWidget.subwidgets() crashes with KeyError 'widget'
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: nobody
Type: Bug | Status: closed
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by GitHub <noreply@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"d2cb7a2bc11f111be04a29b5e4f92a183b18ba88" d2cb7a2b]:
{{{
#!CommitTicketReference repository=""
revision="d2cb7a2bc11f111be04a29b5e4f92a183b18ba88"
Fixed #28039 -- Fixed crash in BaseGeometryWidget.subwidgets().
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:6>

Django

unread,
Apr 20, 2017, 11:41:20 AM4/20/17
to django-...@googlegroups.com
#28039: BaseGeometryWidget.subwidgets() crashes with KeyError 'widget'
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: nobody
Type: Bug | Status: closed
Component: GIS | Version: 1.11
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"5e2bbcd70c9b0213bfda31b90e4b1c35815880e9" 5e2bbcd7]:
{{{
#!CommitTicketReference repository=""
revision="5e2bbcd70c9b0213bfda31b90e4b1c35815880e9"
[1.11.x] Fixed #28039 -- Fixed crash in BaseGeometryWidget.subwidgets().

Backport of d2cb7a2bc11f111be04a29b5e4f92a183b18ba88 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:7>

Reply all
Reply to author
Forward
0 new messages