Beispiel #1
0
def quick_output(format, format_source=None, change_format_xml=None):
    test_output = ToolOutput( "test_output" )
    test_output.format = format
    test_output.format_source = format_source
    if change_format_xml:
        test_output.change_format = XML(change_format_xml)
    else:
        test_output.change_format = None
    return test_output
Beispiel #2
0
def quick_output(format, format_source=None, change_format_xml=None):
    test_output = ToolOutput("test_output")
    test_output.format = format
    test_output.format_source = format_source
    if change_format_xml:
        test_output.change_format = XML(change_format_xml)
    else:
        test_output.change_format = None
    return test_output
    def execute( self, trans, incoming={}, set_output_hid=True, history=None, **kwargs ):
        """
        Overrides Tool.execute() to dynamically add more output elements
        """

        if incoming.has_key('extra_output'):
            try:
                extra_output = json.loads(urllib.unquote(incoming['extra_output']))
                if isinstance(extra_output, list):
                    
                    if len(self.outputs) > 1:
                        for k in self.outputs.keys():
                            if k != 'output':
                                del self.outputs[k]
                    
                    for item in extra_output:
                        output = ToolOutput(item[0])
                        output.format = item[1]
                        output.change_format = None
                        output.format_source = None
                        output.metadata_source = ""
                        output.parent = None
                        output.label = item[2] if len(item) > 2 and item[2] != None else item[0] 
                        output.count = 1
                        output.filters = []
                        output.from_work_dir = None
                        output.hidden = item[3] if len(item) > 3 else False
                        output.tool = self
                        output.actions = ToolOutputActionGroup( output, None )
                        output.dataset_collector_descriptions = [DEFAULT_DATASET_COLLECTOR_DESCRIPTION]
                        self.outputs[ output.name ] = output

            except:
                log.exception('Could not add extra output elements')

        return self.tool_action.execute( self, trans, incoming=incoming, set_output_hid=set_output_hid, history=history, **kwargs )