Improve compatibility and usage of CursorDebugWrapper.

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

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.

    Loading...