From b04b5d326175da6267817faca6239bf02a6e5931 Mon Sep 17 00:00:00 2001 From: Victor Uriarte Date: Sat, 11 Jun 2016 16:43:31 -0700 Subject: Refactor raw conversion on split_unquoted_newlines --- sqlparse/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sqlparse/utils.py') 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: -- cgit v1.2.1