[Django] #24600: Accessing deleted keys in Context objects do not return empty strings (raises KeyError)

11 views
Skip to first unread message

Django

unread,
Apr 8, 2015, 4:01:21 AM4/8/15
to django-...@googlegroups.com
#24600: Accessing deleted keys in Context objects do not return empty strings
(raises KeyError)
-------------------------------+--------------------
Reporter: pattypatpat | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------
In the [https://docs.djangoproject.com/en/dev/ref/templates/api/#playing-
with-context-objects template documentation on playing with context
objects], it is showed that deleting the key `foo` then accessing it again
returns an empty string.

What actually happens: a `KeyError` is raised:

{{{
>>> from django.template import Context
>>> c = Context({'foo': 'bar'})
>>> c['foo']
'bar'
>>> del c['foo']
>>> c['foo']
Traceback (most recent call last):
...
KeyError: 'foo'
}}}

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

Django

unread,
Apr 8, 2015, 5:48:42 AM4/8/15
to django-...@googlegroups.com
#24600: Accessing deleted keys in Context objects do not return empty strings
(raises KeyError)
-------------------------------+--------------------------------------

Reporter: pattypatpat | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by pattypatpat):

* cc: pat.keeps.looking.up@… (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Apr 8, 2015, 7:30:21 AM4/8/15
to django-...@googlegroups.com
#24600: Accessing deleted keys in Context objects do not return empty strings
(raises KeyError)
-------------------------------+--------------------------------------
Reporter: pattypatpat | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"3acefcefeb5283473ac35d7e842027814d57d574" 3acefce]:
{{{
#!CommitTicketReference repository=""
revision="3acefcefeb5283473ac35d7e842027814d57d574"
Fixed #24600 -- Fixed inaccurate example in template Context docs.

Thanks pattypatpat for the report.
}}}

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

Django

unread,
Apr 8, 2015, 7:30:41 AM4/8/15
to django-...@googlegroups.com
#24600: Accessing deleted keys in Context objects do not return empty strings
(raises KeyError)
-------------------------------+--------------------------------------
Reporter: pattypatpat | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------

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

In [changeset:"51e5e2efc6f96166ec3df6fe52a41deefe0fcbe3" 51e5e2e]:
{{{
#!CommitTicketReference repository=""
revision="51e5e2efc6f96166ec3df6fe52a41deefe0fcbe3"
[1.7.x] Fixed #24600 -- Fixed inaccurate example in template Context docs.

Thanks pattypatpat for the report.

Backport of 3acefcefeb5283473ac35d7e842027814d57d574 from master
}}}

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

Django

unread,
Apr 8, 2015, 7:30:45 AM4/8/15
to django-...@googlegroups.com
#24600: Accessing deleted keys in Context objects do not return empty strings
(raises KeyError)
-------------------------------+--------------------------------------
Reporter: pattypatpat | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------+--------------------------------------

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

In [changeset:"9e87017a38cbe9de555000278835d8229b1c5bb2" 9e87017a]:
{{{
#!CommitTicketReference repository=""
revision="9e87017a38cbe9de555000278835d8229b1c5bb2"
[1.8.x] Fixed #24600 -- Fixed inaccurate example in template Context docs.

Thanks pattypatpat for the report.

Backport of 3acefcefeb5283473ac35d7e842027814d57d574 from master
}}}

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

Reply all
Reply to author
Forward
0 new messages