autoimport passes filenames to fpdb_import as unicode, so make bulk import do this as well so that add_import_file() always gets same type
This commit is contained in:
parent
b07505d367
commit
397e87b800
|
@ -152,7 +152,9 @@ class Importer:
|
||||||
#Add an individual file to filelist
|
#Add an individual file to filelist
|
||||||
def addImportFile(self, filename, site = "default", filter = "passthrough"):
|
def addImportFile(self, filename, site = "default", filter = "passthrough"):
|
||||||
#TODO: test it is a valid file -> put that in config!!
|
#TODO: test it is a valid file -> put that in config!!
|
||||||
if filename in self.filelist or not os.path.exists(unicode(filename,'utf-8')):
|
#print "addimportfile: filename is a", filename.__class__
|
||||||
|
# filename now comes in as unicode
|
||||||
|
if filename in self.filelist or not os.path.exists(filename):
|
||||||
return
|
return
|
||||||
self.filelist[filename] = [site] + [filter]
|
self.filelist[filename] = [site] + [filter]
|
||||||
if site not in self.siteIds:
|
if site not in self.siteIds:
|
||||||
|
@ -177,10 +179,11 @@ class Importer:
|
||||||
if os.path.isdir(inputPath):
|
if os.path.isdir(inputPath):
|
||||||
for subdir in os.walk(inputPath):
|
for subdir in os.walk(inputPath):
|
||||||
for file in subdir[2]:
|
for file in subdir[2]:
|
||||||
self.addImportFile(os.path.join(subdir[0], file), site=site,
|
self.addImportFile(unicode(os.path.join(subdir[0], file),'utf-8'),
|
||||||
filter=filter)
|
site=site, filter=filter)
|
||||||
else:
|
else:
|
||||||
self.addImportFile(inputPath, site=site, filter=filter)
|
|
||||||
|
self.addImportFile(unicode(inputPath,'utf-8'), site=site, filter=filter)
|
||||||
#Add a directory of files to filelist
|
#Add a directory of files to filelist
|
||||||
#Only one import directory per site supported.
|
#Only one import directory per site supported.
|
||||||
#dirlist is a hash of lists:
|
#dirlist is a hash of lists:
|
||||||
|
@ -406,7 +409,8 @@ class Importer:
|
||||||
conv = None
|
conv = None
|
||||||
(stored, duplicates, partial, errors, ttime) = (0, 0, 0, 0, time())
|
(stored, duplicates, partial, errors, ttime) = (0, 0, 0, 0, time())
|
||||||
|
|
||||||
file = file.decode("utf-8") #(Configuration.LOCALE_ENCODING)
|
# sc: is there any need to decode this? maybe easier to skip it than guess at the encoding?
|
||||||
|
#file = file.decode("utf-8") #(Configuration.LOCALE_ENCODING)
|
||||||
|
|
||||||
# Load filter, process file, pass returned filename to import_fpdb_file
|
# Load filter, process file, pass returned filename to import_fpdb_file
|
||||||
if self.settings['threads'] > 0 and self.writeq is not None:
|
if self.settings['threads'] > 0 and self.writeq is not None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user