#30005: Example in documentation of transaction.atomic uses both decorator and
context manager
-----------------------------------------+------------------------
Reporter: Peter Hull | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-----------------------------------------+------------------------
In the documentation of transaction.atomic
(https://docs.djangoproject.com/en/2.1/topics/db/transactions
/#controlling-transactions-explicitly), the example below the line
"Wrapping atomic in a try/except block allows for natural handling of
integrity errors" uses both the decorator and the context manager versions
of atomic(). This wouldn't necessarily be a problem except that using the
decorator here causes the example to do exactly what the warning a couple
paragraphs later says not to do: "Avoid catching exceptions inside
atomic!" I suggest that removing the use of the decorator in the example
would be the most prudent edit?
--
Ticket URL: <https://code.djangoproject.com/ticket/30005>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.cf88be64672fc6fe0c572e1f03ba74f8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.