当前位置: 首页>>代码示例>>Python>>正文


Python Task.get_default_approval_xml方法代码示例

本文整理汇总了Python中pyasm.biz.Task.get_default_approval_xml方法的典型用法代码示例。如果您正苦于以下问题:Python Task.get_default_approval_xml方法的具体用法?Python Task.get_default_approval_xml怎么用?Python Task.get_default_approval_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.biz.Task的用法示例。


在下文中一共展示了Task.get_default_approval_xml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_by_code

# 需要导入模块: from pyasm.biz import Task [as 别名]
# 或者: from pyasm.biz.Task import get_default_approval_xml [as 别名]
    def get_by_code(cls, code, allow_default=False):
        '''it is fatal not to have a pipeline, so put a default'''
        if not code:
            return None

        # first look at project specific pipeline
        pipeline = Search.get_by_code("config/pipeline", code)

        if not pipeline:
            pipeline = super(Pipeline,cls).get_by_code(code)

        if not pipeline and code == 'task':
            # Create a default task pipeline
            pipeline = SearchType.create("sthpw/pipeline")
            pipeline.set_value("code", "task")
            from pyasm.biz import Task
            xml = Task.get_default_task_xml()
            pipeline.set_value("pipeline", xml)
            pipeline.set_pipeline(xml)
            pipeline.set_value("search_type", "sthpw/task")
            #pipeline.commit()


        if not pipeline and code == 'approval':
            # Create a default task pipeline
            pipeline = SearchType.create("sthpw/pipeline")
            pipeline.set_value("code", "approval")
            from pyasm.biz import Task
            xml = Task.get_default_approval_xml()
            pipeline.set_value("pipeline", xml)
            pipeline.set_pipeline(xml)
            pipeline.set_value("search_type", "sthpw/task")
            #pipeline.commit()


        if not pipeline and code == 'dependency':
            # Create a default task pipeline
            pipeline = SearchType.create("sthpw/pipeline")
            pipeline.set_value("code", "dependency")
            from pyasm.biz import Task
            xml = Task.get_default_dependency_xml()
            pipeline.set_value("pipeline", xml)
            pipeline.set_pipeline(xml)
            pipeline.set_value("search_type", "sthpw/task")
            #pipeline.commit()





        if not pipeline and allow_default:
            search = Search(cls)
            search.add_filter('code', 'default')
            pipeline = search.get_sobject()
            if not pipeline:
                
                pipeline = cls.create('default',  \
                    'default pipeline', '')

                xml = pipeline.get_xml_value("pipeline")

                # create a default process for the table
                root = xml.get_root_node()
                element = xml.create_element("process")
                Xml.set_attribute(element,"name", "default_process")
                Xml.append_child(root, element)

                pipeline.set_value('pipeline', xml.get_xml())
                pipeline.commit()
                
                # set the pipeline
                pipeline.set_pipeline(pipeline.get_value('pipeline'))
                Environment.add_warning("pipeline autogenerated", \
                    "[default] pipeline has just been created.")
        # Sometimes, a pipeline is instantiated without calling set_pipeline()
        # to be looked into
        if pipeline and not pipeline.get_processes():
            pipeline.set_pipeline(pipeline.get_value('pipeline'))
        return pipeline
开发者ID:0-T-0,项目名称:TACTIC,代码行数:81,代码来源:pipeline.py


注:本文中的pyasm.biz.Task.get_default_approval_xml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。