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


Python Search.get_sobjects方法代码示例

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


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

示例1: get_db_triggers

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def get_db_triggers(cls):

        site_triggers = Container.get(cls.KEY)
        if site_triggers == None:
            # find all of the triggers
            search = Search("sthpw/trigger")
            search.add_project_filter()
            site_triggers = search.get_sobjects()
            Container.put(cls.KEY, site_triggers)

        # find all of the project triggers
        from pyasm.biz import Project
        project_code = Project.get_project_code()
        key = "%s:%s" % (cls.KEY, project_code)
        project_triggers = Container.get(key)
        if project_triggers == None:
            if project_code not in ['admin','sthpw']:
                try:
                    search = Search("config/trigger")
                    project_triggers = search.get_sobjects()
                except SearchException, e:
                    print "WARNING: ", e
                    project_triggers = []
            else:
                project_triggers = []
            Container.put(key, project_triggers)
开发者ID:blezek,项目名称:TACTIC,代码行数:28,代码来源:trigger.py

示例2: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def get_display(self):

        sobject = self.get_current_sobject()
        sobject = sobject.get_parent()
        if not sobject:
            return Widget()

        # get all of the sobject_logs
        search = Search("sthpw/sobject_log")
        search.add_sobject_filter(sobject)
        logs = search.get_sobjects()

        search = Search("sthpw/transaction_log")
        search.add_filters("id", [x.get_value("transaction_log_id") for x in logs] )
        search.set_limit(200)
        logs = search.get_sobjects()
        
        from layout_wdg import TableWdg
        widget = Widget()
        table = TableWdg("sthpw/transaction_log")
        table.add_class("minimal")
        table.set_header_flag(False)
        table.set_show_property(False)
        table.set_no_results_wdg( " " )
        table.set_sobjects(logs)
        widget.add(table)
        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:29,代码来源:clipboard_wdg.py

示例3: get_potential_origin_files

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
def get_potential_origin_files(task_data_code):
    in_files_search = Search('twog/task_data_in_file')
    in_files_search.add_filter('task_data_code', task_data_code)
    in_files = in_files_search.get_sobjects()

    out_files_search = Search('twog/task_data_out_file')
    out_files_search.add_filter('task_data_code', task_data_code)
    out_files = out_files_search.get_sobjects()

    in_files_string = ''
    out_files_string = ''

    if len(in_files) > 0:
        in_files_string = ','.join(["'{0}'".format(in_file.get('file_code')) for in_file in in_files])

    if len(out_files) > 0:
        out_files_string = ','.join(["'{0}'".format(out_file.get('file_code')) for out_file in out_files])

    if in_files_string and out_files_string:
        files_string = in_files_string + ',' + out_files_string
    elif in_files_string:
        files_string = in_files_string
    elif out_files_string:
        files_string = out_files_string
    else:
        return []

    files_search = Search('twog/file')
    files_search.add_where('\"code\" in ({0})'.format(files_string))
    files_search.add_filter('classification', 'deliverable', op='!=')

    files = files_search.get_sobjects()

    return files
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:36,代码来源:utils.py

示例4: get_deliverable_files_in_order

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
def get_deliverable_files_in_order(order_sobject):
    """
    Given an order sobject, return all the deliverable files associated with it.

    :param order_sobject: twog/order sobject
    :return: List of twog/file sobjects
    """

    files_in_order_search = Search('twog/file_in_order')
    files_in_order_search.add_filter('order_code', order_sobject.get_code())
    files_in_order = files_in_order_search.get_sobjects()

    if files_in_order:
        files_in_order_string = ','.join(
            ["'{0}'".format(files_in_order.get('file_code')) for files_in_order in files_in_order]
        )

        deliverable_files_search = Search('twog/file')
        deliverable_files_search.add_where('\"code\" in ({0})'.format(files_in_order_string))
        deliverable_files_search.add_filter('classification', 'deliverable')
        deliverable_files = deliverable_files_search.get_sobjects()

        return deliverable_files
    else:
        return []
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:27,代码来源:utils.py

示例5: execute

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def execute(my):

        my.collection_key = my.kwargs.get("collection_key")

        collection = Search.get_by_search_key(my.collection_key)
        collection_code = collection.get("code")

        search_type = collection.get_base_search_type()
        parts = search_type.split("/")
        collection_type = "%s/%s_in_%s" % (parts[0], parts[1], parts[1])

        search = Search(collection_type)
        search.add_filter("parent_code", collection.get_code())
        items = search.get_sobjects()

        for item in items:
            item.delete()

        # Also need to delete the asset_in_asset relationships in its parent collections
        parent_search = Search(collection_type)
        parent_search.add_filter("search_code", collection.get_code())
        parent_items = parent_search.get_sobjects()

        for parent_item in parent_items:
            parent_item.delete()

        collection.delete()

        my.add_description("Remove Collection [%s]" % collection_code)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:31,代码来源:collection_wdg.py

示例6: main

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
def main():
    task_search = Search('sthpw/task')
    task_search.add_filter('search_type', 'twog/title_order?project=twog')
    task_search.add_filter('status', 'Complete', '!=')

    tasks = task_search.get_sobjects()
    tasks = [task for task in tasks if task.get_parent()]

    final_tasks = []

    for task in tasks:
        print(task.get_value('process'))
        print(task.get_parent())
        process_search = Search('config/process')
        process_search.add_filter('process', task.get_value('process'))

        process_search_results = process_search.get_sobjects()

        if process_search_results:
            pipeline_search = Search('sthpw/pipeline')
            pipeline_search.add_filter('code', task.get_parent().get_value('pipeline_code'))

            pipeline_search_result = pipeline_search.get_sobject()

            xml = get_pipeline_xml(task.get_parent().get_value('pipeline_code'))

            if pipeline_search_result and task_is_assigned_to_group(xml, task.get_value('process'), 'Edel'):
                final_tasks.append(task)

    print([final_task.get('code') for final_task in final_tasks])
    return [final_task.get('code') for final_task in final_tasks]
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:33,代码来源:get_edel_tasks.py

示例7: _get_sobject_history_wdg

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def _get_sobject_history_wdg(my):
        ''' this method is called thru ajax '''
        args = WebContainer.get_web().get_form_args()
        
        # get the args in the URL
        search_type = args['search_type']
        search_id = args['search_id']
        #sobject = Search.get_by_id(search_type, search_id)

        div = Widget()

        search = Search("sthpw/sobject_log")
        search.add_filter("search_type", search_type)
        search.add_filter("search_id", search_id)
        sobjects = search.get_sobjects()

        search = Search("sthpw/transaction_log")
        search.add_filters("id", [x.get_value("transaction_log_id") for x in sobjects] )
        sobjects = search.get_sobjects()


        table = TableWdg("sthpw/transaction_log", "table", css='table')
        table.set_show_property(False)
        table.set_sobjects(sobjects)
        div.add(table)
        div.add(HtmlElement.br(2))

        return div

     
        div.add(assigned_shot_wdg)
        div.add(HtmlElement.br(2))
        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:35,代码来源:asset_detail_wdg.py

示例8: preprocess

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def preprocess(my):
       
        my.is_preprocessed = True
        # get all of the instances

        search = Search("prod/shot_instance")

        # if not used in a TableWdg, only get the shot instances for one asset
        if not my.parent_wdg:
            search.add_filter('asset_code', my.get_current_sobject().get_code())

        search.add_order_by("shot_code")
        instances = search.get_sobjects()

        my.asset_instances = instances

        my.instances = {}
        for instance in instances:
            asset_code = instance.get_value("asset_code")
            
            list = my.instances.get(asset_code)
            if not list:
                list = []
                my.instances[asset_code] = list

            list.append(instance)
       
        search = Search("prod/shot")
        search.add_filters( "code", [x.get_value('shot_code') for x in instances] )
        shots = search.get_sobjects()
        my.shots = SObject.get_dict(shots, ["code"])
        my.shots_list = shots
开发者ID:0-T-0,项目名称:TACTIC,代码行数:34,代码来源:layout_summary_wdg.py

示例9: handle_snapshots

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def handle_snapshots(my):


        path = "__snapshot_files.spt"
        path = "%s/%s" % (my.plugin_dir, path)
        print "Writing: ", path
        # write out an empty file
        #f = open(path, 'w')

        fmode = 'w'
        if os.path.exists(path):
            fmode = 'a'
        f = codecs.open(path, fmode, 'utf-8')
        f.close()


        # get all of the latest snapshots for this plugin
        search = Search("sthpw/snapshot")
        search.add_parent_filter(my.plugin)
        search.add_filter("is_latest", True)
        snapshots = search.get_sobjects()

        if not snapshots:
            return

        # dump out these snapshots
        dumper = TableDataDumper()
        dumper.set_delimiter("#-- Start Entry --#", "#-- End Entry --#")
        dumper.set_include_id(False)
        dumper.set_sobjects(snapshots)
        dumper.dump_tactic_inserts(path, mode='sobject')

        # get all of the files for all of the snapshots and copy the director
        # structure


        # get all of the latest snapshots for this plugin
        search = Search("sthpw/file")
        search.add_relationship_filters(snapshots)
        files = search.get_sobjects()

        # dump out these snapshots
        dumper = TableDataDumper()
        dumper.set_delimiter("#-- Start Entry --#", "#-- End Entry --#")
        dumper.set_include_id(False)
        dumper.set_sobjects(files)
        dumper.dump_tactic_inserts(path, mode='sobject')

        new_dir = "%s/files" % (my.plugin_dir)
        if not os.path.exists(new_dir):
            os.makedirs(new_dir)

        for snapshot in snapshots:
            paths = snapshot.get_all_lib_paths(mode="lib")
            for path in paths:
                file_name = os.path.basename(path)
                new_path = "%s/%s" % (new_dir, file_name)

                shutil.copy(path, new_path)
开发者ID:talha81,项目名称:TACTIC-DEV,代码行数:61,代码来源:plugin.py

示例10: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
 def get_display(my):
     from pyasm.search import Search
     #from tactic_client_lib import TacticServerStub
     barcode = ''
     sources = []
     bad_sources = []
     if 'barcode' in my.kwargs.keys():
         barcode = my.kwargs.get('barcode')
         tracker_s = Search("twog/location_tracker")
         tracker_s.add_filter('location_barcode',barcode)
         trackers = tracker_s.get_sobjects()
         #print "BARCODE = %s" % barcode
         #print "LEN TRACKERS = %s" % len(trackers)
         for t in trackers:
             tdate = t.get('timestamp')
             source_barcode = t.get('source_barcode')
             other_tracks = Search("twog/location_tracker")
             other_tracks.add_filter('source_barcode',source_barcode)
             other_tracks.add_filter('timestamp',tdate, op=">")
             others = other_tracks.get_sobjects()
             if len(others) == 0:
                 source_s = Search("twog/source")
                 source_s.add_filter('barcode',source_barcode)
                 source = source_s.get_sobject()
                 if source:
                     if source.get_value('in_house') in [True,'true','True',1,'1']:
                         sources.append(source)
                 else:
                     bad_sources.append({'barcode': source_barcode, 'title': 'UNKNOWN SOURCE'})
     
     table = Table()
     table.add_attr('class','location_inventory_wdg')
     table.add_row()
     bc = TextWdg('nextbc')
     bc.add_attr('id', 'location_inventory_txtbox')
     bc.add_behavior(my.get_entry_bvr())
     bc.set_value(barcode)
     table.add_cell(bc)
     #print "LEN SOURCES = %s" % len(sources)
     if len(sources) > 0:
         table.add_row()
         table.add_cell("<b>TOTAL: %s (UNKNOWN: %s)</b>" % (len(sources), len(bad_sources)))
     for source in sources:
         table.add_row()
         table.add_cell('Barcode: %s, Code: %s, Name: %s: %s' % (source.get_value('barcode'), source.get_code(), source.get_value('title'), source.get_value('episode')))
     if len(bad_sources) > 0:
         table.add_row()
         table.add_cell("<b>UNKNOWN SOURCES</b>")
         for b in bad_sources:
             table.add_row()
             table.add_cell('Barcode: %s, Name: %s' % (b.get('barcode'), b.get('title')))
     widget = DivWdg()
     widget.add(table)
     return widget
开发者ID:2gDigitalPost,项目名称:custom,代码行数:56,代码来源:asset_tracker.py

示例11: init_color_map

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def init_color_map(my):
        ''' initialize the color map for bg color and text color'''
        search_type = my.kwargs.get('search_type')
        
        if not search_type:
            search_type = 'sthpw/task'

        # get the color map
        from pyasm.widget import WidgetConfigView
        color_config = WidgetConfigView.get_by_search_type(search_type, "color")
        color_xml = color_config.configs[0].xml
        my.color_map = {}
        name = 'status'
        xpath = "config/color/element[@name='%s']/colors" % name
        text_xpath = "config/color/element[@name='%s']/text_colors" % name
        bg_color_node = color_xml.get_node(xpath)
        bg_color_map = color_xml.get_node_values_of_children(bg_color_node)

        text_color_node = color_xml.get_node(text_xpath)
        text_color_map = color_xml.get_node_values_of_children(text_color_node)
        
        # use old weird query language
        query = bg_color_map.get("query")
        query2 = bg_color_map.get("query2")
        if query:
            bg_color_map = {}

            search_type, match_col, color_col = query.split("|")
            search = Search(search_type)
            sobjects = search.get_sobjects()

            # match to a second table
            if query2:
                search_type2, match_col2, color_col2 = query2.split("|")
                search2 = Search(search_type2)
                sobjects2 = search2.get_sobjects()
            else:
                sobjects2 = []

            for sobject in sobjects:
                match = sobject.get_value(match_col)
                color_id = sobject.get_value(color_col)

                for sobject2 in sobjects2:
                    if sobject2.get_value(match_col2) == color_id:
                        color = sobject2.get_value(color_col2)
                        break
                else:
                    color = color_id


                bg_color_map[match] = color

        my.color_map[name] = bg_color_map, text_color_map
开发者ID:0-T-0,项目名称:TACTIC,代码行数:56,代码来源:sobject_calendar_wdg.py

示例12: get_input_snapshots

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def get_input_snapshots(my, sobject, process_name, input_name, version='latest'):
        '''gets the snapshots of the input'''
        assert version in ['latest', 'current']

        process_node = my.xml.get_node( "pipeline/process[@name='%s']/input[@name='%s']" % (process_name, input_name))

        search_type = Xml.get_attribute(process_node, "search_type")
        context = Xml.get_attribute(process_node, "context")
        filter = Xml.get_attribute(process_node, "filter")


        # get the sobjects
        sobjects = sobject.get_all_children(search_type)

        # get the snapshots
        search = Search("sthpw/snapshot")
        search.add_filter('context', context)
        #if version == 'latest':
        #    search.add_filter("is_latest", 1)
        #elif version == 'current':
        #    search.add_filter("is_current", 1)


        # build filters for search_type, search_id combinations
        filters = []
        for sobject in sobjects:
            filter = "(\"search_type\" = '%s' and \"search_id\" = %s)" % (sobject.get_search_type(), sobject.get_id() )
            filters.append(filter)
        
        search.add_where( "( %s )" % " or ".join(filters) )

        snapshots = search.get_sobjects()
        return snapshots
开发者ID:0-T-0,项目名称:TACTIC,代码行数:35,代码来源:pipeline.py

示例13: execute

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def execute(my):

        my.search_type = my.kwargs.get('search_type')
        my.element_name = my.kwargs.get('element_name')
        #print "Calculating aggregate: ", my.search_type, my.element_name

        my.view = my.kwargs.get('view')
        if not my.view:
            my.view = 'definition'

        config = WidgetConfigView.get_by_search_type(search_type=my.search_type, view=my.view)
        widget = config.get_display_widget(my.element_name)

        # calculate all of the values
        search = Search(my.search_type)
        sobjects = search.get_sobjects()
        widget.set_sobjects(sobjects)
        widget.kwargs['use_cache'] = "false"

        for i, sobject in enumerate(sobjects):
            widget.set_current_index(i)
            value = widget.get_text_value()

            print sobject.get_code(), "value [%s]: " %value

            # all cache columns need are named with a c_ preceeding it
            # s_status
            # c_element_name
            #
            # this_month -> c_this_month
            #column = "c_%s" % my.element_name
            #sobject.set_value(column, value)
            sobject.set_value(my.element_name, value)
            sobject.commit()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:36,代码来源:aggregate_wdg.py

示例14: get_audio_configuration_table

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
def get_audio_configuration_table(element_eval_sobject):
    audio_configuration_lines_search = Search('twog/audio_evaluation_line')
    audio_configuration_lines_search.add_filter('element_evaluation_code', element_eval_sobject.get_code())
    audio_configuration_lines = audio_configuration_lines_search.get_sobjects()

    # If no audio configuration lines exist for this element evaluation, return None so that the PDF won't display
    # a table
    if not audio_configuration_lines:
        return None

    audio_configuration_table_data = [
        [
            get_paragraph('<strong>Channel</strong>'),
            get_paragraph('<strong>Content</strong>'),
            get_paragraph('<strong>Tone</strong>'),
            get_paragraph('<strong>Peak</strong>')
        ]
    ]

    for line in audio_configuration_lines:
        channel = line.get('channel')
        content = line.get('content')
        tone = line.get('tone')
        peak = line.get('peak')

        # If all the items in a row are blank, skip it
        if any([channel, content, tone, peak]):
            line_data = [channel, content, tone, peak]

            audio_configuration_table_data.append(line_data)

    audio_configuration_table = Table(audio_configuration_table_data, hAlign='LEFT', spaceBefore=5, spaceAfter=5)

    return audio_configuration_table
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:36,代码来源:export_element_eval_command.py

示例15: execute

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_sobjects [as 别名]
    def execute(my):
        my.add_description("Set task's context to match process if empty")
        search = Search('sthpw/task')
        search.add_filter('context', None)
        tasks = search.get_sobjects()
        if tasks and len(tasks) > 700:
	    print "More than 700 tasks are found. Exiting as a precaution."
	    sys.exit(0)
        if not tasks: 
            print "All tasks have context attribute filled in. Exiting."
            sys.exit(0)

        ctr = 0
        for task in tasks:
            context = task.get_value('context')
            process = task.get_value('process')
            search_type = task.get_value('search_type')
            # delete dangling task
            if not search_type:
                task.delete()
                continue
            if not context and process:
                task.set_value('context', process)
                task.commit(triggers=False)
                ctr += 1
        print "%s tasks have been processed. Their context are matched with their process." %ctr   
开发者ID:0-T-0,项目名称:TACTIC,代码行数:28,代码来源:mod_task.py


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