diff options
| author | Rob Hudson | 2009-09-22 19:14:31 -0700 | 
|---|---|---|
| committer | Rob Hudson | 2009-09-22 19:20:50 -0700 | 
| commit | 6c05fad6a9835ae22481b90d6b58f00f90929663 (patch) | |
| tree | 4034b0eb6cfb628782e3106126e621c6c2ab780d /debug_toolbar/management/commands/debugsqlshell.py | |
| parent | 39174123f6d7371664b448604d421a66bed74cb0 (diff) | |
| download | django-debug-toolbar-6c05fad6a9835ae22481b90d6b58f00f90929663.tar.bz2 | |
Added sqlparse, replacing my simple string replace SQL keywords and updating
management command and SQL panel.
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 | 
