diff options
| author | Rob Hudson | 2009-10-16 20:35:10 -0700 |
|---|---|---|
| committer | Rob Hudson | 2009-10-16 20:35:10 -0700 |
| commit | d446d1b7032cce610d0e78965a66316e16c82924 (patch) | |
| tree | fb469440487bbebecaa32c3f2416e1eea64230c9 /debug_toolbar/management/commands/debugsqlshell.py | |
| parent | 5d4fbe175509c73f461c5271a555c952465eeded (diff) | |
| parent | 56a673fd9414bad98388023a151e618bbb46835d (diff) | |
| download | django-debug-toolbar-d446d1b7032cce610d0e78965a66316e16c82924.tar.bz2 | |
Merge branch 'master' into tx-master
Diffstat (limited to 'debug_toolbar/management/commands/debugsqlshell.py')
| -rw-r--r-- | debug_toolbar/management/commands/debugsqlshell.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/debug_toolbar/management/commands/debugsqlshell.py b/debug_toolbar/management/commands/debugsqlshell.py index 84b4a2f..eaeafd4 100644 --- a/debug_toolbar/management/commands/debugsqlshell.py +++ b/debug_toolbar/management/commands/debugsqlshell.py @@ -4,12 +4,7 @@ from optparse import make_option from django.core.management.base import NoArgsCommand from django.db.backends import util -# Optional sqlparse to make the SQL look pretty... -# http://code.google.com/p/python-sqlparse/ -try: - import sqlparse -except ImportError: - sqlparse = None +from debug_toolbar.utils import sqlparse class PrintQueryWrapper(util.CursorDebugWrapper): def execute(self, sql, params=()): @@ -17,10 +12,7 @@ class PrintQueryWrapper(util.CursorDebugWrapper): return self.cursor.execute(sql, params) finally: raw_sql = self.db.ops.last_executed_query(self.cursor, sql, params) - if sqlparse: - print sqlparse.format(raw_sql, reindent=True) - else: - print raw_sql + print sqlparse.format(raw_sql, reindent=True) print util.CursorDebugWrapper = PrintQueryWrapper |
