changeset 3645:8fbdd3667488

parser.text_csv: simplified code for removing empty lines
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 25 May 2008 23:51:52 +0200
parents a54a08994dcb
children 68da15c7eeec 40f2cce6f6d9
files MoinMoin/parser/text_csv.py
diffstat 1 files changed, 2 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_csv.py	Sun May 25 23:16:51 2008 +0200
+++ b/MoinMoin/parser/text_csv.py	Sun May 25 23:51:52 2008 +0200
@@ -54,17 +54,8 @@
         formatter = request.formatter
 
         # workaround csv.reader deficiency by encoding to utf-8
-        data = raw.encode('utf-8').split('\n')
-
-        # workaraound to remove empty lines in front of the csv table
-        # if this is not done this parser shows only an empty line
-        count = 0
-        for txt in data:
-            if not txt:
-                count += 1
-            else:
-                data = data[count:]
-                break
+        # removes empty lines in front of the csv table
+        data = raw.encode('utf-8').lstrip('\n').split('\n')
 
         delimiter = ';'
         # Previous versions of this parser have used only the delimiter ";" (by default).