Better solution for previous commit
svn: r16131
This commit is contained in:
parent
6f9ed19a04
commit
5ec8c5ddf0
@ -37,6 +37,18 @@ import sys
|
||||
from Filters._FilterParser import FilterParser
|
||||
from gen.plug import BasePluginManager
|
||||
|
||||
def flatten(mylist):
|
||||
"""
|
||||
Flattens a nested list into a single list.
|
||||
"""
|
||||
retval = []
|
||||
for item in mylist:
|
||||
if isinstance(item, (list, tuple)):
|
||||
retval.extend(flatten(item))
|
||||
else:
|
||||
retval.append(item)
|
||||
return retval
|
||||
|
||||
PLUGMAN = BasePluginManager.get_instance()
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -85,7 +97,7 @@ class FilterList(object):
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
filters += plugin_filters
|
||||
return filters
|
||||
return flatten(filters)
|
||||
|
||||
def add(self, namespace, filt):
|
||||
assert(isinstance(namespace, basestring))
|
||||
|
@ -46,9 +46,5 @@ def build_filter_model(space, local = []):
|
||||
return None
|
||||
|
||||
for filt in flist:
|
||||
if isinstance(filt, (list, tuple)):
|
||||
for subfilt in filt:
|
||||
model.append(row=[subfilt.get_name(), subfilt])
|
||||
else:
|
||||
model.append(row=[filt.get_name(), filt])
|
||||
model.append(row=[filt.get_name(), filt])
|
||||
return model
|
||||
|
Loading…
Reference in New Issue
Block a user