less broken, please check sanity

This commit is contained in:
Matt Turnbull 2009-02-25 14:59:11 +00:00
parent 65c34a7377
commit e5489056ff
2 changed files with 15 additions and 1 deletions

View File

@ -55,7 +55,7 @@ class GuiBulkImport():
hhc=self.cbfilter.get_model()[self.cbfilter.get_active()][0] hhc=self.cbfilter.get_model()[self.cbfilter.get_active()][0]
self.lab_info.set_text("Importing") self.lab_info.set_text("Importing")
self.importer.addImportFile(self.inputFile,filter=hhc) self.importer.addBulkImportImportFileOrDir(self.inputFile,filter=hhc)
self.importer.setCallHud(False) self.importer.setCallHud(False)
starttime = time() starttime = time()
(stored, dups, partial, errs, ttime) = self.importer.runImport() (stored, dups, partial, errs, ttime) = self.importer.runImport()

View File

@ -113,6 +113,20 @@ class Importer:
#TODO: test it is a valid file -> put that in config!! #TODO: test it is a valid file -> put that in config!!
self.filelist[filename] = [site] + [filter] self.filelist[filename] = [site] + [filter]
# Called from GuiBulkImport to add a file or directory.
def addBulkImportImportFileOrDir(self, inputPath,filter = "passthrough"):
"""Add a file or directory for bulk import"""
# Bulk import never monitors
# if directory, add all files in it. Otherwise add single file.
# TODO: only add sane files?
if os.path.isdir(inputPath):
for subdir in os.walk(inputPath):
for file in subdir[2]:
self.addImportFile(os.path.join(inputPath, subdir, file), site="default", filter=filter)
else:
self.addImportFile(inputPath, site="default", 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: