Code

Opened 18 months ago

Closed 18 months ago

Last modified 17 months ago

#19683 closed Bug (fixed)

A minor mistake?

Reported by: sunsongxp@… Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords: signing
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by aaugustin)

https://docs.djangoproject.com/en/1.4/topics/signing/

In this page, which is about signing, enumerates several examples about how to use it. When it comes to that handling Exception, to be specific,

>>> value += 'm'
>>> try:
...    original = signer.unsign(value)
... except signing.BadSignature:
...    print "Tampering detected!"

I found that these lines failed, the error shows signing.BadSignature is not defined, I tested a while, and then I knew,

from django.core import signing

is required. The example miss that. I don't know if that count as a mistake. Besides, the information about previous line is so scarce in reference, do I need to check the source code?

Attachments (0)

Change History (4)

comment:1 Changed 18 months ago by aaugustin

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Bug

Yes -- it's a good practice to include relevant imports in code samples.

comment:2 Changed 18 months ago by Tim Graham <timograham@…>

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

In 537d44b1b937c6857ded0a2dc5703c61c5e980b4:

Fixed #19683 - Added a missing import in signing example.

Thanks sunsongxp@ for the report.

comment:3 Changed 18 months ago by Tim Graham <timograham@…>

In f6075b0596e20951bd8232f09d97fb7fac08308c:

[1.5.x] Fixed #19683 - Added a missing import in signing example.

Thanks sunsongxp@ for the report.

Backport of 537d44b1b9 from master

comment:4 Changed 17 months ago by Tim Graham <timograham@…>

In f6075b0596e20951bd8232f09d97fb7fac08308c:

[1.5.x] Fixed #19683 - Added a missing import in signing example.

Thanks sunsongxp@ for the report.

Backport of 537d44b1b9 from master

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.