diff options
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/filters/others.py | 4 | ||||
| -rw-r--r-- | sqlparse/utils.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py index 6951c74..71b1f8e 100644 --- a/sqlparse/filters/others.py +++ b/sqlparse/filters/others.py @@ -6,7 +6,6 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php from sqlparse import sql, tokens as T -from sqlparse.compat import text_type from sqlparse.utils import split_unquoted_newlines @@ -114,6 +113,5 @@ class SpacesAroundOperatorsFilter(object): class SerializerUnicode(object): @staticmethod def process(stmt): - raw = text_type(stmt) - lines = split_unquoted_newlines(raw) + lines = split_unquoted_newlines(stmt) return '\n'.join(line.rstrip() for line in lines) diff --git a/sqlparse/utils.py b/sqlparse/utils.py index 8253e0b..4a8646d 100644 --- a/sqlparse/utils.py +++ b/sqlparse/utils.py @@ -9,6 +9,7 @@ import itertools import re from collections import deque from contextlib import contextmanager +from sqlparse.compat import text_type # This regular expression replaces the home-cooked parser that was here before. # It is much faster, but requires an extra post-processing step to get the @@ -33,11 +34,12 @@ SPLIT_REGEX = re.compile(r""" LINE_MATCH = re.compile(r'(\r\n|\r|\n)') -def split_unquoted_newlines(text): +def split_unquoted_newlines(stmt): """Split a string on all unquoted newlines. Unlike str.splitlines(), this will ignore CR/LF/CR+LF if the requisite character is inside of a string.""" + text = text_type(stmt) lines = SPLIT_REGEX.split(text) outputlines = [''] for line in lines: |
