minor fixes
This commit is contained in:
@@ -23,4 +23,4 @@ if __name__ == '__main__':
|
|||||||
generator.write_files(argv[3])
|
generator.write_files(argv[3])
|
||||||
else:
|
else:
|
||||||
print 'Usage:', split(argv[0])[-1], '<CSV file>', '<Template file>', '[Output directory]'
|
print 'Usage:', split(argv[0])[-1], '<CSV file>', '<Template file>', '[Output directory]'
|
||||||
print '(c)2013 Ivan "Kai SD" Korystin'
|
print '(c)2013 Ivan "Kai SD" Korystin'
|
||||||
|
|||||||
11
att/data.py
11
att/data.py
@@ -217,7 +217,7 @@ class CSVData(Data):
|
|||||||
for row in rows:
|
for row in rows:
|
||||||
self.writerow(row)
|
self.writerow(row)
|
||||||
|
|
||||||
def __init__(self, file, encoding='utf-8', delimiter=';', quotechar='"', **kwargs):
|
def __init__(self, file, encoding='utf-8', delimiter=',', quotechar='"', **kwargs):
|
||||||
'''
|
'''
|
||||||
Constructor.
|
Constructor.
|
||||||
|
|
||||||
@@ -226,13 +226,14 @@ class CSVData(Data):
|
|||||||
delimiter - CSV table delimiter (default: ;)
|
delimiter - CSV table delimiter (default: ;)
|
||||||
quotechar - CSV table quotechar (default: ")
|
quotechar - CSV table quotechar (default: ")
|
||||||
'''
|
'''
|
||||||
|
f = None
|
||||||
if file:
|
if file:
|
||||||
if type(file) == str:
|
if type(file) == str:
|
||||||
with open(file) as f:
|
f = open(file)
|
||||||
csvfile = self.Reader(f, encoding=encoding, delimiter=delimiter, quotechar=quotechar)
|
csvfile = self.Reader(f, encoding=encoding, delimiter=delimiter, quotechar=quotechar)
|
||||||
else:
|
else:
|
||||||
csvfile = self.Reader(file, encoding=encoding, delimiter=delimiter, quotechar=quotechar)
|
csvfile = self.Reader(file, encoding=encoding, delimiter=delimiter, quotechar=quotechar)
|
||||||
|
|
||||||
source_data = []
|
source_data = []
|
||||||
source_keys = None;
|
source_keys = None;
|
||||||
|
|
||||||
@@ -252,6 +253,8 @@ class CSVData(Data):
|
|||||||
|
|
||||||
self.keys = source_keys
|
self.keys = source_keys
|
||||||
self.rows = source_data
|
self.rows = source_data
|
||||||
|
if not f is None:
|
||||||
|
f.close();
|
||||||
else:
|
else:
|
||||||
super(CSVData, self).__init__()
|
super(CSVData, self).__init__()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user