Merge branch 'master' of git://git.assembla.com/mctfpdb
This commit is contained in:
commit
59136c70d1
|
@ -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()
|
||||||
|
|
|
@ -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[0], 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:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user