diff options
Diffstat (limited to 'paste/webkit/FakeWebware/MiscUtils/CSVJoiner.py')
-rw-r--r-- | paste/webkit/FakeWebware/MiscUtils/CSVJoiner.py | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/paste/webkit/FakeWebware/MiscUtils/CSVJoiner.py b/paste/webkit/FakeWebware/MiscUtils/CSVJoiner.py deleted file mode 100644 index 2bc13a9..0000000 --- a/paste/webkit/FakeWebware/MiscUtils/CSVJoiner.py +++ /dev/null @@ -1,21 +0,0 @@ -import types - - -def joinCSVFields(fields): - """ - Returns a CSV record (eg a string) from a sequence of fields. - Fields containing commands (,) or double quotes (") are quotes - and double quotes are escaped (""). The terminating newline is - NOT included. - """ - newFields = [] - for field in fields: - assert type(field) is types.StringType - if field.find('"')!=-1: - newField = '"' + field.replace('"', '""') + '"' - elif field.find(',')!=-1 or field.find('\n')!=-1 or field.find('\r')!=-1: - newField = '"' + field + '"' - else: - newField = field - newFields.append(newField) - return ','.join(newFields) |