Remove passthrough section from import_file_dict

This commit is contained in:
Worros 2009-06-20 14:02:03 +08:00
parent 706ce46a9f
commit 22ff98d7c9

View File

@ -288,36 +288,34 @@ class Importer:
if os.path.isdir(file): if os.path.isdir(file):
self.addToDirList[file] = [site] + [filter] self.addToDirList[file] = [site] + [filter]
return return
if filter == "passthrough" or filter == "":
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(file, site)
else:
conv = None
# Load filter, process file, pass returned filename to import_fpdb_file
print "\nConverting %s" % file conv = None
hhbase = self.config.get_import_parameters().get("hhArchiveBase") # Load filter, process file, pass returned filename to import_fpdb_file
hhbase = os.path.expanduser(hhbase)
hhdir = os.path.join(hhbase,site)
try:
out_path = os.path.join(hhdir, file.split(os.path.sep)[-2]+"-"+os.path.basename(file))
except:
out_path = os.path.join(hhdir, "x"+strftime("%d-%m-%y")+os.path.basename(file))
filter_name = filter.replace("ToFpdb", "") print "\nConverting %s" % file
hhbase = self.config.get_import_parameters().get("hhArchiveBase")
hhbase = os.path.expanduser(hhbase)
hhdir = os.path.join(hhbase,site)
try:
out_path = os.path.join(hhdir, file.split(os.path.sep)[-2]+"-"+os.path.basename(file))
except:
out_path = os.path.join(hhdir, "x"+strftime("%d-%m-%y")+os.path.basename(file))
mod = __import__(filter) filter_name = filter.replace("ToFpdb", "")
obj = getattr(mod, filter_name, None)
if callable(obj): mod = __import__(filter)
conv = obj(in_path = file, out_path = out_path) obj = getattr(mod, filter_name, None)
if(conv.getStatus()): if callable(obj):
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(out_path, site) conv = obj(in_path = file, out_path = out_path)
else: if(conv.getStatus()):
# conversion didn't work (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(out_path, site)
# TODO: appropriate response?
return (0, 0, 0, 1, 0)
else: else:
print "Unknown filter filter_name:'%s' in filter:'%s'" %(filter_name, filter) # conversion didn't work
return # TODO: appropriate response?
return (0, 0, 0, 1, 0)
else:
print "Unknown filter filter_name:'%s' in filter:'%s'" %(filter_name, filter)
return
#This will barf if conv.getStatus != True #This will barf if conv.getStatus != True
return (stored, duplicates, partial, errors, ttime) return (stored, duplicates, partial, errors, ttime)