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


Python Search.get_by_id方法代码示例

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


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

示例1: get_ref_obj

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def get_ref_obj(self, sobject):
        search_type = sobject.get_value("search_type")
        search_code = sobject.get_value("search_code", no_exception=True)
        if not search_code:
            search_id = sobject.get_value("search_code")
        else:
            search_id = None

        key = SearchKey.build_search_key(search_type, search_code)

        ref_sobject = self.ref_sobj_dict.get(str(key))
        if not ref_sobject:
            try:
                if search_code:
                    ref_sobject = Search.get_by_code(search_type, search_code)
                else:
                    ref_sobject = Search.get_by_id(search_type, search_id)

                if not ref_sobject:
                    return None
            except SearchException as e:
                print e.__str__()
                return None

        return ref_sobject
开发者ID:mincau,项目名称:TACTIC,代码行数:27,代码来源:group_element_wdg.py

示例2: get_sobject_from_form

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def get_sobject_from_form(my):
        search_type = my.get_form_value("search_type")
        search_id = my.get_form_value("search_id")
        from pyasm.search import Search

        sobject = Search.get_by_id(search_type, search_id)
        return sobject
开发者ID:hus787,项目名称:TACTIC,代码行数:9,代码来源:web_environment.py

示例3: preprocess

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def preprocess(my):
        search_type_list  = SObject.get_values(my.sobjects, 'search_type', unique=True)
        search_id_dict = {}
        my.ref_sobject_cache = {}

        # initialize the search_id_dict
        for type in search_type_list:
            search_id_dict[type] = []
        # cache it first
        for sobject in my.sobjects:
            search_type = sobject.get_value('search_type')
            search_id_list = search_id_dict.get(search_type)
            search_id_list.append(sobject.get_value('search_id'))

        from pyasm.search import SearchException
        for key, value in search_id_dict.items():
            try:
                ref_sobjects = Search.get_by_id(key, value)
                sobj_dict = SObject.get_dict(ref_sobjects)
            except SearchException, e:
                print "WARNING: search_type [%s] with id [%s] does not exist" % (key, value)
                print str(e)
                sobj_dict = {}

            # store a dict of dict with the search_type as key
            my.ref_sobject_cache[key] = sobj_dict
开发者ID:0-T-0,项目名称:TACTIC,代码行数:28,代码来源:prod_wdg.py

示例4: get_item_list

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
 def get_item_list(my, items):
     my.select = SelectWdg(my.SELECT_NAME)
     my.select.set_attr("size", '%s' %(len(items)+1))
     if items == ['']:
         return my.select
     my.select.set_option('values', items)
     code_col = my.web.get_form_value('code_col')
     labels = []
     # assume they are all the same search type
     search_ids = [item.split("|", 1)[1] for item in items]
     search_type = ''
     if items:
         search_type = items[0].split('|', 1)[0]
     if search_type and search_ids: 
         sobjs =  Search.get_by_id(search_type, search_ids)
         for sobj in sobjs:
             name = sobj.get_name()
             code = sobj.get_code()
             if code_col and sobj.has_value(code_col):
                 code = sobj.get_value(code_col) 
             if name == code:
                 labels.append(code)
             else:
                 labels.append('%s - %s' %(code, name))
     
     my.select.set_option('labels', labels)
     return my.select
开发者ID:0-T-0,项目名称:TACTIC,代码行数:29,代码来源:task_wdg.py

示例5: get_display

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

        widget = Widget()

        search_type = web.get_form_value("parent_search_type")
        search_id = web.get_form_value("parent_search_id")

        if not search_type:
            widget.add("RenderSubmitInfo: parent type not found")
            return widget

        hidden = HiddenWdg("parent_search_type", search_type)
        widget.add(hidden)
        hidden = HiddenWdg("parent_search_id", search_id)
        widget.add(hidden)

        sobject = Search.get_by_id(search_type, search_id)
        table = TableWdg(search_type, css="embed")
        table.set_show_property(False)
        table.set_sobject(sobject)
        table.remove_widget("render")
        table.remove_widget("description")
        widget.add(table)

        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:render_wdg.py

示例6: add_header

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def add_header(self, table, title):
        table.add_style('width', '50em')
        
        parent_st = self.kwargs.get('parent_search_type')
        parent_sid =  self.kwargs.get('parent_search_id')
        parent_context = ''
        parent_version = ''

        sobj = Search.get_by_id(parent_st, parent_sid)
        sobj_code = 'New'
        sobj_title = ''
        if sobj:
            sobj_code = sobj.get_code()
            sobj_title = sobj.get_search_type_obj().get_title()
            if isinstance(sobj, Snapshot):
                parent_context = sobj.get_context()
                parent_version = sobj.get_version()
        th = table.add_header( "Add Submission for %s [%s]" % (sobj_title, sobj_code))
        th.set_attr("colspan", "2")
        hidden = HiddenWdg('parent_search_type', parent_st )
        th.add(hidden)
        hidden = HiddenWdg('parent_search_id', parent_sid )
        th.add(hidden)
        
        hidden = HiddenWdg('parent_context', parent_context )
        th.add(hidden)

        hidden = HiddenWdg('parent_version', parent_version )
        th.add(hidden)
        
        if sobj:
            hidden = HiddenWdg('parent_search_key', SearchKey.get_by_sobject(sobj) )
            th.add(hidden)
开发者ID:mincau,项目名称:TACTIC,代码行数:35,代码来源:submission_wdg.py

示例7: get_parent_dir

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def get_parent_dir(my, search_type=None, context=None, sobject=None):
        from project import Project

        if not sobject:
            sobject = my.sobject
        if search_type:
            parent = sobject.get_parent(search_type)
        else:
            search_type = sobject.get_value("search_type")
            search_id = sobject.get_value("search_id")
            parent = Search.get_by_id(search_type, search_id)

        if not parent:
            raise TacticException("No parent exists for '%s', possibly a result of Shot rename or removal." % sobject.get_code())

        # just use the latest of the context desired
        if context:
            search_id = parent.get_id()
            search_type = parent.get_search_type()
            snapshot = Snapshot.get_latest(search_type, search_id, context)
        else:
            # basically this means that without a parent context, there is
            # no way to know the directory this is in.
            snapshot = None
        dirs = Project._get_dir( my.protocol,parent,snapshot,None )
        dirs = dirs.split("/")
        return dirs
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:29,代码来源:dir_naming.py

示例8: get_message

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def get_message(my):
        
        search_type_obj = my.sobject.get_search_type_obj()
        title = search_type_obj.get_title()
        
        notification_message = my.notification.get_value("message")

        message = "%s %s" % (title, my.sobject.get_name())
        if notification_message:
            message = "%s (%s)" %(message, notification_message)

        update_desc = my.sobject.get_update_description()
        parent_search_type = my.sobject.get_value('search_type')
        grand_parent = None
        if 'prod/submission' in parent_search_type:
            parent = Search.get_by_id(parent_search_type, my.sobject.get_value('search_id') )
            snapshot = Snapshot.get_latest_by_sobject(parent, 'publish')
            if snapshot:
                file_name = snapshot.get_file_name_by_type('main')
                update_desc = '%s \n %s \n' %(update_desc, file_name)
            grand_parent = parent.get_parent()
            if grand_parent:
                update_desc = '%s %s'%(update_desc, grand_parent.get_code())
        command_desc = my.command.get_description()

        message = '%s\n\nReport from transaction:\n%s\n\n%s' \
            % (message, update_desc, command_desc)
        return message
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:30,代码来源:email_handler.py

示例9: get_sobject

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def get_sobject(my, direction="dst"):
        assert direction in ['src', 'dst']

        search_type = my.get_value("%s_search_type" % direction)
        search_id = my.get_value("%s_search_id" % direction)

        sobject = Search.get_by_id(search_type, search_id)
        return sobject
开发者ID:blezek,项目名称:TACTIC,代码行数:10,代码来源:sobject_connection.py

示例10: get_display

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

        # get the args in the URL
        args = WebContainer.get_web().get_form_args()
        search_type = args['search_type']
        search_id = args['search_id']

        sobject = Search.get_by_id(search_type, search_id)

        main_div = DivWdg()
        main_div.add_style("width: 98%")
        main_div.add_style("float: right")
        my.add(main_div)

        # get planned assets
        planned_head, planned_div = my.get_planned_wdg(sobject)
        main_div.add(planned_head)
        main_div.add(planned_div)


        # add notes
        notes_head, notes_div = my.get_sobject_wdg(sobject, "sthpw/note", "summary")
        main_div.add(notes_head)
        main_div.add(notes_div)

        # add storyboards
        story_head, story_div = my.get_sobject_wdg(sobject, "prod/storyboard", "summary")
        main_div.add(story_head)
        main_div.add(story_div)

        # add references
        ref_head, ref_div = my.get_sobject_wdg(sobject, "sthpw/connection","detail",title="Reference Material")
        main_div.add(ref_head)
        main_div.add(ref_div)
        
        task_head, task_div = my.get_sobject_wdg(sobject, "sthpw/task", "summary")
        main_div.add(task_head)
        main_div.add(task_div)



        # add dailies: need a special function for this
        dailies_head, dailies_div = my.get_dailies_wdg(sobject)
        main_div.add(dailies_head)
        main_div.add(dailies_div)


        # add history div
        hist_head, hist_div = my.get_history_wdg(sobject)
        main_div.add(hist_head)
        main_div.add(hist_div)

        return main_div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:55,代码来源:flash_summary_wdg.py

示例11: get_info

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
 def get_info(self):
     # check if the sobj type is the same
     search_types = SObject.get_values(self.sobjs, 'search_type', unique=True)
     search_ids = SObject.get_values(self.sobjs, 'search_id', unique=False)
   
     infos = []
     # this doesn't really work if the same asset is submitted multiple times
     if len(search_types) == 1 and len(search_ids) == len(self.sobjs):
         assets = []
         if search_types[0]:
             assets = Search.get_by_id(search_types[0], search_ids)
         
         asset_dict = SObject.get_dict(assets)
         for id in search_ids:
             asset = asset_dict.get(id)
             aux_dict = {}
             aux_dict['info'] = SubmissionInfo._get_target_sobject_data(asset)
             aux_dict['search_key'] = '%s:%s' %(search_types[0], id)
             infos.append(aux_dict)
         
     else:
         # TODO: this is a bit database intensive, mixed search_types not
         # recommended
         search_types = SObject.get_values(self.sobjs, 'search_type',\
             unique=False)
         for idx in xrange(0, len(search_types)):
             search_type = search_types[idx]
                 
             aux_dict = {}
             aux_dict['info'] = ''
             aux_dict['search_key'] = ''
             if search_type:
                 asset = Search.get_by_id(search_type, search_ids[idx])
                 aux_dict['info'] = SubmissionInfo._get_target_sobject_data(asset)
                 aux_dict['search_key'] = '%s:%s' %(search_types[idx], search_ids[idx])
             infos.append(aux_dict)
     return infos
开发者ID:mincau,项目名称:TACTIC,代码行数:39,代码来源:submission_wdg.py

示例12: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def get_display(my):
        my.div = DivWdg()
        
        my.div.add_style("font-size: 0.7em")
         
        sobject = my.get_current_sobject()
        if not sobject:
            web = WebContainer.get_web()
            search_type = web.get_form_value("search_type")
            search_id = web.get_form_value("search_id")
            sobject = Search.get_by_id(search_type, search_id)
  
        if sobject.is_general_asset():

            import_span = SpanWdg("", css='small')
            import_span.set_style("font-size: 8px")
            import_span.set_id("import_progress_%s" %sobject.get_id())
            flash_snap = my.snapshot_dict.get(sobject.get_search_key())
            my.add_import_wdg(sobject, flash_snap, import_span)
            my.div.add(HtmlElement.br(2))
            # an upload/copy widget
            my.add_upload_wdg(sobject)
            #NOTE: download only is setup if this asset is not importable
            
        else:
            my.load_wdg = FlashLoadWdg()

            if my.get_option("load_mode"):
                my.load_wdg.set_load_mode(my.get_option("load_mode"))

            my.load_wdg.set_sobject(sobject)
            flash_snap = my.snapshot_dict.get(sobject.get_search_key())
            my.load_wdg.set_snapshot(flash_snap) 
            my.div.add(my.load_wdg)
            my.div.add(HtmlElement.br(2))
            # just setting up download for Float menu, does not draw
            my.add_download_wdg(sobject, flash_snap)

            publish = SpanWdg("", css='small')
            publish.set_style("font-size: 8px")
            publish.set_id(publish.generate_unique_id("pub_progress"))
     
            if my.get_option("publish") != "false":
                my.add_publish_wdg(sobject, publish)
      
            if my.get_option("wip") != "false":
                my.add_wip_wdg(sobject)

        return my.div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:51,代码来源:flash_snapshot_wdg.py

示例13: _get_child_wdg

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
 def _get_child_wdg(my):
     ''' this method is called thru ajax '''
     web = WebContainer.get_web()
     args = web.get_form_args()
     
     # get the args in the URL
     search_type = args['search_type']
     search_id = args['search_id']
     pipeline_search_key = args['pipeline_skey']
     sobject = Search.get_by_id(search_type, search_id)
     child_pipeline = Search.get_by_search_key(pipeline_search_key)
     status_wdg = ParallelStatusWdg()
     status_wdg.set_sobject(sobject)
     status_wdg.set_pipeline(child_pipeline)
     status_wdg.preprocess()
     return status_wdg
开发者ID:0-T-0,项目名称:TACTIC,代码行数:18,代码来源:parallel_status.py

示例14: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def get_display(self):
        web = WebContainer.get_web()
        parent_search_type = web.get_form_value("parent_search_type")
        parent_search_id = web.get_form_value("parent_search_id")
        parent = Search.get_by_id(parent_search_type, parent_search_id)

        value = ''
        if parent:
            if parent.has_value("description"):
                value = parent.get_value("description")
            else:
                value = parent.get_name()

        self.set_value(value)

        return super(SubmissionDescriptionWdg,self).get_display()
开发者ID:mincau,项目名称:TACTIC,代码行数:18,代码来源:submission_wdg.py

示例15: _get_planned_wdg

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_id [as 别名]
    def _get_planned_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)

        assets_int_shot_wdg = AssetsInShotWdg()
        assets_int_shot_wdg.set_sobject(sobject)

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


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