FIX: reader option field_sep could have been set by template, pgloader.table too

This commit is contained in:
dim 2007-11-28 10:06:10 +00:00
parent 141d8ec19a
commit b85cc13d08
2 changed files with 7 additions and 3 deletions

View File

@ -182,7 +182,8 @@ class PGLoader:
else:
# Reading Configuration Template section
# we want the attribute to exists for further usage
self.__dict__[opt] = None
if opt not in self.__dict__:
self.__dict__[opt] = None
##
# we parse some columns definitions

View File

@ -60,8 +60,10 @@ class DataReader:
else:
self.db.empty_string = EMPTY_STRING
# optionnal field separator
self.field_sep = FIELD_SEP
# optionnal field separator, could be defined from template
if 'field_sep' not in self.__dict__:
self.field_sep = FIELD_SEP
if config.has_option(name, 'field_sep'):
self.field_sep = config.get(name, 'field_sep')
@ -73,6 +75,7 @@ class DataReader:
print "reader.readconfig null: '%s'" % self.db.null
print "reader.readconfig empty_string: '%s'" \
% self.db.empty_string
print "reader.readconfig field_sep: '%s'" % self.field_sep
def readlines(self):
""" read data from configured file, and generate (yields) for