Opened 6 years ago

Closed 6 years ago

#10971 closed (fixed)

Test client response.redirect_chain documentation example missing follow argument

Reported by: yourcelf 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 yourcelf 6 years ago.
Patch to fix redirect_chain documentation example

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by yourcelf

Patch to fix redirect_chain documentation example

comment:1 Changed 6 years ago by yourcelf

  • Component changed from Uncategorized to Documentation
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by timo

  • Has patch set
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:3 Changed 6 years ago by kmtracey

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

(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