#4613 closed (invalid)
KeyError in sessions after changeset 5482 with newforms
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | sessions | |
Cc: | ferringb@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
After 5482 appeared KeyError in django/contrib/sessions/middleware.py in _getitem_, line 20 with newforms
Attachments (1)
Change History (7)
comment:1 by , 17 years ago
Summary: | KeyError in sessions after changeset 5482 → KeyError in sessions after changeset 5482 with newforms |
---|
comment:2 by , 17 years ago
The domain name doesn't resolve for me, so I can't download the test case.
comment:4 by , 17 years ago
Cc: | added |
---|
comment:5 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
(For anybody else looking at this, unpack the tarball, ensure SQLite is available and run syncdb then runserver and access localhost:8000/ and follow the instructions.)
This is not a bug in Django, as best I can understand it.
The code seems to be relying on the fact that the RegisterForm.__del__
method has been called at some point to set up self.session['expression_result']
. You basically can't rely on __del__
being called at a predictable moment in Python. Any code that does that is likely to hit problems when another reference to the object is taken, for example. That is exactly what is happening in this case (an iterator somewhere is holding a reference).
The problem here is in the sample code making unjustified assumptions about execution order.
Because upload does not work, this is link to example django-project with KeyError:
http://vega-holding.ru/media/r5482.tar.gz