Opened 16 months ago

Closed 16 months ago

Last modified 16 months ago

#21515 closed Uncategorized (fixed)

template.Context Documentation: c.pop() and c.push() return nothing in the example

Reported by: oubiga Owned by: nobody
Component: Documentation Version: 1.6
Severity: Normal Keywords: context, pop, push
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: no UI/UX: no

Description

https://docs.djangoproject.com/en/1.6/ref/templates/api/#django.template.Context.pop shows:

>>> c = Context()
>>> c['foo'] = 'first level'
>>> c.push()
>>> c['foo'] = 'second level'
>>> c['foo']
'second level'
>>> c.pop()
>>> c['foo']
'first level'

Is my suggestion more understandable?

>>> c = Context()
>>> c['foo'] = 'first level'
>>> c.push()
{}
>>> c['foo'] = 'second level'
>>> c['foo']
'second level'
>>> c.pop()
{'foo': 'second level'}
>>> c['foo']
'first level'

Change History (3)

comment:1 Changed 16 months ago by Baptiste Mispelon <bmispelon@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 077af42139db84d88f293ab5eadc989a9169dce1:

Fixed #21515 -- Corrected example of template.Context in documentation.

Thanks to trac user oubiga for the report.

comment:2 Changed 16 months ago by Baptiste Mispelon <bmispelon@…>

In 02f9e90fdfe795992d674094fe25919bb885bf0d:

[1.6.x] Fixed #21515 -- Corrected example of template.Context in documentation.

Thanks to trac user oubiga for the report.

Backport of 077af42139db84d88f293ab5eadc989a9169dce1 from master.

comment:3 Changed 16 months ago by Baptiste Mispelon <bmispelon@…>

In 0e98050847644f66c6aad38e359d560594a7a4cc:

[1.5.x] Fixed #21515 -- Corrected example of template.Context in documentation.

Thanks to trac user oubiga for the report.

Backport of 077af42139db84d88f293ab5eadc989a9169dce1 from master.

Note: See TracTickets for help on using tickets.
Back to Top