示例#1
0
    def __build_config_file_text(self, content):
        if isinstance(content, str):
            return content, True

        config_type = content.get("type", "inputs")
        if config_type == "inputs":
            content_format = content["format"]
            handle_files = content["handle_files"]
            if content_format != "json":
                template = "Galaxy can only currently convert inputs to json, format [%s] is unhandled"
                message = template % content_format
                raise Exception(message)
        elif config_type == "files":
            user_context = ProvidesUserFileSourcesUserContext(
                self.request_context)
            file_sources_dict = self.app.file_sources.to_dict(
                for_serialization=True, user_context=user_context)
            rval = json.dumps(file_sources_dict)
            return rval, False
        else:
            raise Exception(f"Unknown config file type {config_type}")

        return json.dumps(
            wrapped_json.json_wrap(self.tool.inputs,
                                   self.param_dict,
                                   self.tool.profile,
                                   handle_files=handle_files)), False
示例#2
0
    def __build_config_file_text( self, content ):
        if isinstance( content, string_types ):
            return content, True

        content_format = content["format"]
        if content_format != "json":
            template = "Galaxy can only currently convert inputs to json, format [%s] is unhandled"
            message = template % content_format
            raise Exception(message)

        return json.dumps(wrapped_json.json_wrap(self.tool.inputs, self.param_dict)), False
示例#3
0
    def __build_config_file_text( self, content ):
        if isinstance( content, string_types ):
            return content, True

        content_format = content["format"]
        if content_format != "json":
            template = "Galaxy can only currently convert inputs to json, format [%s] is unhandled"
            message = template % content_format
            raise Exception(message)

        return json.dumps(wrapped_json.json_wrap(self.tool.inputs, self.param_dict)), False