diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2012-04-19 21:21:53 +0200 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2012-04-19 21:21:53 +0200 |
| commit | 508db7329f05362a47a0ed9f93d0ae8d9e42dcc8 (patch) | |
| tree | c5f0abbc25fc62a8b285758e6ab0082d169f16e8 /sqlparse | |
| parent | 748749e596ebf10a9adc763f970cfde446bac978 (diff) | |
| download | sqlparse-508db7329f05362a47a0ed9f93d0ae8d9e42dcc8.tar.gz | |
Preserve whitespace after subgroups.
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/filters.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py index 6bb3415..3d2355a 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -218,10 +218,11 @@ class StripWhitespaceFilter(Filter): tlist.tokens.pop(-2) self._stripws_default(tlist) - def process(self, stack, stmt): - [self.process(stack, sgroup) for sgroup in stmt.get_sublists()] + def process(self, stack, stmt, depth=0): + [self.process(stack, sgroup, depth+1) + for sgroup in stmt.get_sublists()] self._stripws(stmt) - if stmt.tokens[-1].is_whitespace(): + if depth == 0 and stmt.tokens[-1].is_whitespace(): stmt.tokens.pop(-1) @@ -610,4 +611,4 @@ class Limit(Filter): if index and token_type in Keyword and value == 'LIMIT': return stream[4 - index][1] - return -1
\ No newline at end of file + return -1 |
