Opened 12 years ago

Last modified 12 years ago

#19683 closed Bug

A minor mistake? — at Version 1

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 Aymeric Augustin)

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?

Change History (1)

comment:1 by Aymeric Augustin, 12 years ago

Description: modified (diff)
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

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

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