diff options
| author | Vladislav Poluhin | 2013-04-24 11:14:34 +0800 |
|---|---|---|
| committer | Vladislav Poluhin | 2013-04-24 11:14:34 +0800 |
| commit | 3d0467d9a4394c4b994a802e6e861ff2562dbb2b (patch) | |
| tree | 0b2aefc7b73ffbbe94e2505bbac01e31d99c2166 /debug_toolbar/utils/sqlparse | |
| parent | e85dfe8ef37d6d99ee482fbd9ac3375ee86253ac (diff) | |
| download | django-debug-toolbar-3d0467d9a4394c4b994a802e6e861ff2562dbb2b.tar.bz2 | |
Got rid of the circular imports
Diffstat (limited to 'debug_toolbar/utils/sqlparse')
| -rw-r--r-- | debug_toolbar/utils/sqlparse/filters.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/debug_toolbar/utils/sqlparse/filters.py b/debug_toolbar/utils/sqlparse/filters.py index 897cc90..6443a3c 100644 --- a/debug_toolbar/utils/sqlparse/filters.py +++ b/debug_toolbar/utils/sqlparse/filters.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import re +from django.utils.html import escape from debug_toolbar.utils.sqlparse import tokens as T from debug_toolbar.utils.sqlparse import sql @@ -423,3 +424,16 @@ class OutputPHPFilter(Filter): varname = self.varname stmt.tokens = tuple(self._process(stmt.tokens, varname)) return stmt + + +class BoldKeywordFilter(Filter): + """sqlparse filter to bold SQL keywords""" + def process(self, stack, stream): + """Process the token stream""" + for token_type, value in stream: + is_keyword = token_type in T.Keyword + if is_keyword: + yield T.Text, '<strong>' + yield token_type, escape(value) + if is_keyword: + yield T.Text, '</strong>' |
