#13870: Document transaction/connection management outside the web server 
context
-------------------------------+------------------------------------
     Reporter:  patrys         |                    Owner:  nobody
         Type:  New feature    |                   Status:  new
    Component:  Documentation  |                  Version:  master
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  1              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  1
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------
Changes (by akaariai):

 * needs_better_patch:  0 => 1


Comment:

 I think this needs to be changed:
 {{{
 As soon as you perform an action that needs to write to the database, ...
 }}}
 to mention that only write actions through the ORM count here.

 This paragraph seems to be out of place / context:
 {{{
 This goes against the fact that PostgreSQL thinks the transaction requires
 a
 ``ROLLBACK`` because Django issued a ``SET`` command for the timezone.
 }}}

 Also, the section discussing the dirty flag isn't accurate. The dirty flag
 has nothing to do with doing the commit in autocommit mode - the commits
 are done manually in the write operations Django performs by issuing
 commit_unless_managed. The docs should only mention that as long as you
 perform any query which isn't a write using the ORM, then there will be an
 open transaction and this will not be closed automatically by Django.

 Typo: meeded -> needed

 The docs additions do not take into account multidb. I think it would be a
 good idea to add a context manager @close_connections which ensures all
 connections (known to Django) will be closed. This would simplify the
 solution part a lot: use @close_connections, be done with it (except if
 you are playing with threads).

 It might be a good idea to commit the docs changes with the above
 suggested changes apart of the multidb stuff. We might want to do more
 extensive edit of the transaction handling docs for multidb, or we might
 want to add the close_connections decorator. But, I don't know what the
 schedule for those are, so they shouldn't block the currently available
 improvements.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/13870#comment:10>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to