#22873: Allow disabling debug cursor when DEBUG=True
-------------------------------------+-------------------------------------
     Reporter:  john@…               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:
     Keywords:                       |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by john@…):

 This was added way back in 2010 in [5506653] by Alex Gaynor to support
 tests for `assertNumQueries`, fixing #5416.  Previously, the code directly
 looked at `settings.DEBUG`.  It may have been the intention to allow more
 control over the new debug cursor, but the most direct reason was to
 support the new assertion without forcing the test to run with
 `DEBUG=True`.  `assertNumQueries` might now be broken when queries pass
 9000, but that's probably rare and silly.

 If `use_debug_cursor` it could initialized to `settings.DEBUG` in the
 `__init__` method, then it could be set or cleared by code as needed.  I'm
 not familiar with early settings loading, so it is possible that settings
 isn't initialized at this point.

 If the current behavior is retained, `force_debug_cursor` is a better
 name, making it clearer that this is a private hook for testing.

 If this undocumented API goes away, I could instead fail the management
 command when `DEBUG=True`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22873#comment:2>
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/080.a5a14a153cb1ba1cc6f594bfca7d3707%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to