remove a commented out import
[htsworkflow.git] / bcmagic / plugin.py
1 #BCM_PLUGINS = {'cmd_move_sample': bcm_cmds.cmd_move_sample}
2
3 _SEARCH_FUNCTIONS = {}
4
5 def bcm_plugin_processor(keyword, text, bcm_mode):
6     """
7     Fixme should be made generic plugable, but am hard coding values for proof
8     of concept.
9     """
10     d = {}
11     
12     if bcm_mode not in BCM_PLUGINS:
13         d['mode'] = 'Error'
14         d['status'] = 'bcm_mode plugin called "%s" was not found' % (bcm_mode)
15         return d
16     
17     return BCM_PLUGINS[bcm_mode](keyword, text, bcm_mode)
18     
19
20 def register_search_plugin(label, search_function):
21     """
22     Registers a group label and search_function
23     
24     search_function(search_string) --> (text_display, obj_url)
25     """
26     
27     if label in _SEARCH_FUNCTIONS:
28         msg = "search function for label (%s) already registered." % (label)
29         raise ValueError, msg
30     
31     _SEARCH_FUNCTIONS[label] = search_function
32