Opened 7 years ago

Closed 7 years ago

#10971 closed (fixed)

Test client response.redirect_chain documentation example missing follow argument

Reported by: Charlie DeTar Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The documentation for the django test Client includes an example for showing redirect chains which is broken.

The provided example:

>>> response = c.get('/redirect_me')
>>> response.redirect_chain

results in:

AttributeError: 'HttpResponseRedirect' object has no attribute 'redirect_chain'

This is because follow was not set to True. The example should read:

>>> response = c.get('/redirect_me', follow=True)
>>> response.redirect_chain
[(u'http://testserver/next/', 302), (u'http://testserver/final/', 302)]

Attachments (1)

redirect_chain_docs.diff (594 bytes) - added by Charlie DeTar 7 years ago.
Patch to fix redirect_chain documentation example

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by Charlie DeTar

Attachment: redirect_chain_docs.diff added

Patch to fix redirect_chain documentation example

comment:1 Changed 7 years ago by Charlie DeTar

Component: UncategorizedDocumentation
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 7 years ago by Tim Graham

Has patch: set
Triage Stage: UnreviewedReady for checkin

comment:3 Changed 7 years ago by Karen Tracey

Resolution: fixed
Status: newclosed

(In [10807]) Fixed #10971 -- Corrected code example involving redirect_chain in the testing doc. Thanks yourcelf.

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