Merge branch 'master' of git://git.assembla.com/mctfpdb

This commit is contained in:
Worros 2009-02-26 01:24:15 +09:00
commit 59136c70d1
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]
self.lab_info.set_text("Importing")
self.importer.addImportFile(self.inputFile,filter=hhc)
self.importer.addBulkImportImportFileOrDir(self.inputFile,filter=hhc)
self.importer.setCallHud(False)
starttime = time()
(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!!
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[0], file), site="default", filter=filter)
else:
self.addImportFile(inputPath, site="default", filter=filter)
#Add a directory of files to filelist
#Only one import directory per site supported.
#dirlist is a hash of lists: