Improve compatibility and usage of CursorDebugWrapper.

Review Request #8685 — Created Jan. 31, 2017 and submitted

Information

Djblets
release-0.10.x
ca0ed92...

Reviewers

This improves CursorDebugWrapper to be compatible with modern versions
of Django, and to implement missing functionality.

Our CursorDebugWrapper was re-implementing logic from Django's, instead
of just using the base logic, which didn't make sense and wasn't
future-proof. We now heavily rely on the base functionality.

We register CursorDebugWrapper in a better way. The old way of
overriding the version on the module wasn't safe, and caused infinite
loop issues on newer versions of Django. We now instead override the
method on BaseDatabaseWrapper that creates and returns an instance of
the CursorDebugWrapper, which is safer.

Last but not least, we weren't adding stack traces for executemany()
calls. While Django itself doesn't make use of this method, applications
might. We now store the stack trace for these calls as well.

Unit tests were added for both methods.

Unit tests pass on Django 1.6, 1.7, 1.8, 1.9, and 1.10.

Description From Last Updated

'time' imported but unused

reviewbotreviewbot

redefinition of unused 'time' from line 11

reviewbotreviewbot

'User' imported but unused

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/log/tests/test_cursor_debug_wrapper.py
        djblets/log/middleware.py
    
    Ignored Files:
        djblets/log/tests/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/log/tests/test_cursor_debug_wrapper.py
        djblets/log/middleware.py
    
    Ignored Files:
        djblets/log/tests/__init__.py
    
    
  2. djblets/log/middleware.py (Diff revision 1)
     
     
    Show all issues
     'time' imported but unused
    
  3. djblets/log/middleware.py (Diff revision 1)
     
     
    Show all issues
     redefinition of unused 'time' from line 11
    
  4. Show all issues
     'User' imported but unused
    
  5. 
      
chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        djblets/log/tests/test_cursor_debug_wrapper.py
        djblets/log/middleware.py
    
    Ignored Files:
        djblets/log/tests/__init__.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        djblets/log/tests/test_cursor_debug_wrapper.py
        djblets/log/middleware.py
    
    Ignored Files:
        djblets/log/tests/__init__.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.10.x (0f64631)
Loading...