Code

Opened 5 years ago

Closed 5 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 5 years ago.
Patch to fix redirect_chain documentation example

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by yourcelf

Patch to fix redirect_chain documentation example

comment:1 Changed 5 years ago by yourcelf

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

comment:2 Changed 5 years ago by timo

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

comment:3 Changed 5 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.