From 38b1106fed5ea75165d81c87855a1f7c1e0cd71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s=20Combarro=20=22Piranna=22?= Date: Sat, 24 Mar 2012 18:00:57 +0100 Subject: Fixed bug on StripWhitespace --- sqlparse/filters.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'sqlparse') diff --git a/sqlparse/filters.py b/sqlparse/filters.py index a639f7a..83c466b 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -80,24 +80,17 @@ def StripWhitespace(stream): last_type = None for token_type, value in stream: - print repr(token_type), repr(value) # We got a previous token if last_type: - print '\t 1', repr(token_type), repr(value) - if token_type in Whitespace: - if last_type in Whitespace: + if last_type in (Whitespace, Whitespace.Newline, Punctuation): continue value = ' ' # Ignore first empty spaces and dot-commas - elif token_type in Whitespace + Punctuation: + elif token_type in (Whitespace, Whitespace.Newline, Punctuation): continue - # There's no previous token - else: - print '\t 2', repr(token_type), repr(value) - yield token_type, value last_type = token_type -- cgit v1.2.1