sbsv2/raptor/python/filter_list.py
branchfix
changeset 533 408bfff46ad7
parent 3 e1eecf4d390d
child 534 3b10c85868b1
--- a/sbsv2/raptor/python/filter_list.py	Fri Apr 23 22:37:45 2010 +0100
+++ b/sbsv2/raptor/python/filter_list.py	Mon Apr 26 17:33:17 2010 +0100
@@ -81,14 +81,23 @@
 		# Find all the filter plugins
 		self.pbox = pbox
 		possiblefilters = self.pbox.classesof(filter_interface.Filter)
+		filterdict = {}
+		for p in possiblefilters:
+			name = p.__name__.lower()
+			if name in filterdict:
+				raise ValueError("filters found in SBS_HOME/python/plugins which have duplicate name: %s " % p.__name__)
+			else:
+				filterdict[name] = p
+
 		unfound = []
 		self.filters = []
 		for f in filternames:
-			unfound.append(f) # unfound unless we find it
-			for pl in possiblefilters:
-				if pl.__name__.upper() == f.upper():
-					self.filters.append(pl())
-					unfound = unfound[:-1]
+			found = False
+			if f.lower() in filterdict:
+				self.filters.append(filterdict[f.lower()])
+			else:
+				unfound.append(f)
+
 		if unfound != []:
 			raise ValueError("requested filters not found: %s \
 			\nAvailable filters are: %s" % (str(unfound), self.format_output_list(possiblefilters)))