summaryrefslogtreecommitdiff
path: root/sqlparse
diff options
context:
space:
mode:
authorJesús Leganés Combarro "Piranna" <piranna@gmail.com>2012-06-02 00:36:54 +0200
committerJesús Leganés Combarro "Piranna" <piranna@gmail.com>2012-06-02 00:36:54 +0200
commitb89d03804d16c064d237e26340853bf4b3ed41f0 (patch)
tree870bb79eb11d9442235eaad3d40e294511e3f861 /sqlparse
parentc7115f84fea3fd16922b5a3012d04a4ec185bb3d (diff)
downloadsqlparse-b89d03804d16c064d237e26340853bf4b3ed41f0.tar.gz
Moved check for Function
Diffstat (limited to 'sqlparse')
-rw-r--r--sqlparse/filters.py54
1 files changed, 28 insertions, 26 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py
index 3ee2607..271bb75 100644
--- a/sqlparse/filters.py
+++ b/sqlparse/filters.py
@@ -422,32 +422,34 @@ class ReindentFilter:
If there are more than an identifier, put each on a line
"""
- # Get identifiers from the tlist
- identifiers = list(tlist.get_identifiers())
-
- # Split the identifier list if we have more than one identifier
- # and its not from a function
- if len(identifiers) > 1 and not tlist.within(sql.Function):
- # Get first token
- first = list(identifiers[0].flatten())[0]
-
- # Increase offset the size of the first token
- num_offset = self._get_offset(first) - len(first.value)
-
- # Increase offset and insert new lines
- self.offset += num_offset
-
- # Insert a new line between the tokens
- for token in identifiers[1:]:
- tlist.insert_before(token, self.nl())
-
- # Imsert another new line after comment tokens
- for token in tlist.tokens:
- if isinstance(token, sql.Comment):
- tlist.insert_after(token, self.nl())
-
- # Decrease offset the size of the first token
- self.offset -= num_offset
+ # Split the identifier list if we are not in a function
+ if not tlist.within(sql.Function):
+ # Get identifiers from the tlist
+ identifiers = list(tlist.get_identifiers())
+ print identifiers
+
+ # Split the identifier list if we have more than one identifier
+ if len(identifiers) > 1:
+ # Get first token
+ first = list(identifiers[0].flatten())[0]
+
+ # Increase offset the size of the first token
+ num_offset = self._get_offset(first) - len(first.value)
+
+ # Increase offset and insert new lines
+ self.offset += num_offset
+
+ # Insert a new line between the tokens
+ for token in identifiers[1:]:
+ tlist.insert_before(token, self.nl())
+
+ # Imsert another new line after comment tokens
+ for token in tlist.tokens:
+ if isinstance(token, sql.Comment):
+ tlist.insert_after(token, self.nl())
+
+ # Decrease offset the size of the first token
+ self.offset -= num_offset
# Process the identifier list as usual
self._process_default(tlist)