Filters can now be added through plugins register(GENERAL, category='Filter: Person', etc)

svn: r15793
This commit is contained in:
Doug Blank 2010-08-22 02:37:07 +00:00
parent 00f738f953
commit c3c1fb6bb6

View File

@ -51,10 +51,23 @@ class FilterList(object):
self.file = os.path.expanduser(file)
def get_filters(self, namespace='generic'):
from gen.plug import BasePluginManager
if namespace in self.filter_namespaces:
filters = self.filter_namespaces[namespace]
else:
filters = []
PLUGMAN = BasePluginManager.get_instance()
plugins = PLUGMAN.process_plugin_data('Filter: %s' % namespace)
try:
return self.filter_namespaces[namespace]
except KeyError:
return []
plugin_filters = [plug for plug in [plug() if callable(plug)
else plug
for plug in plugins]
if plug is not None]
except:
plugin_filters = []
import traceback
traceback.print_exc()
return filters + plugin_filters
def add(self, namespace, filt):
assert(isinstance(namespace, basestring))