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


Python Search.get_by_search_key方法代码示例

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


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

示例1: execute

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

        left_cb_name , right_cb_name = self.get_checkbox_names()
        
        web = WebContainer.get_web()

        right_search_keys = web.get_form_values(right_cb_name)
        if not right_search_keys:
            return

        right_sobjects = []
        for right_search_key in right_search_keys:
            right_sobject = Search.get_by_search_key(right_search_key)
            right_sobjects.append(right_sobject)

        search_type = self.get_search_type()

        left_search_keys = web.get_form_values(left_cb_name)
        for left_search_key in left_search_keys:

            left_sobject = Search.get_by_search_key( left_search_key )
            for right_sobject in right_sobjects:
                #instance_name = "%s" % right_sobject.get_value("name")

                left_foreign_key = left_sobject.get_foreign_key()
                right_foreign_key = right_sobject.get_foreign_key()

                instance = SObjectFactory.create(search_type)
                instance.set_value(left_foreign_key, left_sobject.get_code() )
                instance.set_value(right_foreign_key, right_sobject.get_code() )

                name = left_sobject.get_code()
                instance.set_value("name", name)
                instance.commit()
开发者ID:mincau,项目名称:TACTIC,代码行数:36,代码来源:sobject_planner_wdg.py

示例2: generate_icon

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

        sobject = Search.get_by_search_key(search_key)
        search_code = sobject.get_code()
        search_type = sobject.get_search_type()
        base_search_type = sobject.get_base_search_type()


        if base_search_type == 'sthpw/snapshot':
            snapshot_code = sobject.get_code()

            file_type = "main"
            path = sobject.get_lib_path_by_type(file_type)

            icon_creator = IconCreator(path)
            icon_creator.execute()

            web_path = icon_creator.get_web_path()
            icon_path = icon_creator.get_icon_path()
            if web_path:
                sub_file_paths = [web_path, icon_path]
                sub_file_types = ['web', 'icon']

            from pyasm.checkin import FileAppendCheckin
            checkin = FileAppendCheckin(snapshot_code, sub_file_paths, sub_file_types, mode="inplace")
            checkin.execute()
            snapshot = checkin.get_snapshot()


        else:

            snapshot = Snapshot.get_snapshot(search_type, search_code, process=['publish',''])

            if not snapshot:
                return

            file_type = "main"
            path = snapshot.get_lib_path_by_type(file_type)


            # use api
            from tactic_client_lib import TacticServerStub
            server = TacticServerStub.get()
            snapshot = server.simple_checkin(search_key, "icon", path, mode="copy")


            # need the actual sobject to get the path to replace the icon
            # in the ui
            snapshot = Search.get_by_search_key(snapshot.get("__search_key__"))


        my.path = snapshot.get_web_path_by_type("icon")
开发者ID:funic,项目名称:TACTIC,代码行数:54,代码来源:file_wdg.py

示例3: get_sobject

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_search_key [as 别名]
 def get_sobject(my):
     search_key = my.kwargs.get("search_key")
     my.sobject = Search.get_by_search_key(search_key)
     my.parent = None
     if my.sobject:
         my.parent = my.sobject.get_parent()
     return my.sobject
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:9,代码来源:sobject_wdg.py

示例4: preprocess

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_search_key [as 别名]
    def preprocess(self):
        self.search_key = self.kwargs.get("search_key")
        if self.search_key:
            self.sobject = Search.get_by_search_key(self.search_key)
        else:
            self.sobject = None

        self.path_info = self.kwargs.get("path_info")
        self.paths = self.kwargs.get("paths")
        if not self.paths:
            self.paths = []

        sizes = self.kwargs.get("sizes")

        self.sizes = {}

        #for path, size in zip(self.paths, sizes):
        i = 0
        for path in self.paths:
            if path.endswith("/"):
                continue

            size = sizes[i]
            self.sizes[path] = size
            i += 1
开发者ID:mincau,项目名称:TACTIC,代码行数:27,代码来源:scm_dir_list_wdg.py

示例5: get_display

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

        search_key = my.kwargs.get('parent_key')

        div = DivWdg()

        if not search_key:
            div.add("Search Key for SObjectHeaderHdg is empty")
            return div

        sobject = Search.get_by_search_key( search_key )
        if not sobject:
            div.add("SObject with Search Key [%s] does not exist" % search_key)
            return div


        search_type_obj = sobject.get_search_type_obj()
        title = search_type_obj.get_title()
        title_wdg = DivWdg()
        title_wdg.add_style("font-size: 1.8em")

        name = sobject.get_display_value()
        title_wdg.add("%s: %s" % (title, name ))

        div.add(title_wdg)
        div.add(HtmlElement.hr())

        return div
开发者ID:southpawtech,项目名称:TACTIC-DEV,代码行数:30,代码来源:custom_layout_wdg.py

示例6: init_cgi

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_search_key [as 别名]
 def init_cgi(my):
     # get the sobject
     keys = my.web.get_form_keys()
     search_key = ''
     
     for key in keys:
         if key.startswith('skey_TimecardWdg_'):
             search_key = my.web.get_form_value(key)
             continue
         if key.startswith('week_'):
             my.week_element_name = key
             my.week = my.web.get_int_form_value(key)
             continue
         if key.startswith('year_'):
             my.year_element_name = key
             my.year = my.web.get_int_form_value(key)
             continue
     if search_key:
         sobject = Search.get_by_search_key(search_key)
         my.task = sobject
         
         my.init_setup()
     
     
         my.add_inputs()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:27,代码来源:timecard_wdg.py

示例7: prod_render

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_search_key [as 别名]
    def prod_render(my,dirs):
        search_type = my.sobject.get_value("search_type")
        search_id = my.sobject.get_value("search_id")

        ref_sobject = Search.get_by_search_key("%s|%s" % (search_type,search_id))
        # get shot and episode code
        shot_code = ref_sobject.get_value("code")
        shot = Shot.get_by_code(shot_code)
        episode_code = ''
        if shot:
            episode_code = shot.get_value("episode_code")

        name = ''
        if ref_sobject.has_value('name'):
            name = ref_sobject.get_value("name")

        # build the path
        dirs = my.get_default(dirs)
        dirs.append(episode_code)
        dirs.append(shot_code)
        if name:
            dirs.append(name)

        version = my.sobject.get_value("version")
        dirs.append("%04d" % version)

        return dirs
开发者ID:0-T-0,项目名称:TACTIC,代码行数:29,代码来源:flash_dir_naming.py

示例8: execute

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

示例9: preprocess

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_search_key [as 别名]
    def preprocess(my):
        my.search_key = my.kwargs.get("search_key")
        if my.search_key:
            my.sobject = Search.get_by_search_key(my.search_key)
        else:
            my.sobject = None

        my.path_info = my.kwargs.get("path_info")
        my.paths = my.kwargs.get("paths")
        if not my.paths:
            my.paths = []

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

        my.sizes = {}

        #for path, size in zip(my.paths, sizes):
        i = 0
        for path in my.paths:
            if path.endswith("/"):
                continue

            size = sizes[i]
            my.sizes[path] = size
            i += 1
开发者ID:blezek,项目名称:TACTIC,代码行数:27,代码来源:scm_dir_list_wdg.py

示例10: execute

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

        web = WebContainer.get_web()
        cam_search_key = web.get_form_value(FlashRenderTableElementWdg.RENDER_CAM)
        # FIXME: why is this called "context"
        context_name = web.get_form_value(FlashRenderTableElementWdg.CONTEXT_NAME)

        # submit all the selected sobjects
        context = "publish"
        for search_key in my.search_keys:
            sobject = Search.get_by_search_key(search_key)

            snapshot = Snapshot.get_latest_by_sobject(sobject, context)
            if not snapshot:
                raise TacticException("No checkins of context '%s' for '%s' exists" % (context, sobject.get_code()))
            render = FlashGenerateExecuteXml(sobject.get_code())
            render.set_snapshot_code(snapshot.get_code())

            # render.execute()

            # store this in the appropriate queue
            dispatch = TacticDispatcher()
            dispatch.set_description("Flash Render: %s" % sobject.get_code())
            dispatch.execute_slave(render)

        my.description = "Submitted: %s" % ", ".join(my.search_keys)
开发者ID:hellios78,项目名称:TACTIC,代码行数:29,代码来源:flash_render_wdg.py

示例11: handle_td

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_search_key [as 别名]
 def handle_td(my, td):
     super(LoginTableElementWdg, my).handle_td(td)
     task = my.get_current_sobject()
     if task:
         search_type = task.get_value('search_type')
         search_id = task.get_value('search_id')
         
         if not search_type or not search_id:
             return
         
         search_key = SearchKey.build_search_key(search_type, search_id, column='id')
         
         from pyasm.common import SObjectSecurityException
         try:
             parent = Search.get_by_search_key(search_key)
             pipeline = Pipeline.get_by_sobject(parent)
            
             if pipeline:
                 attrs = pipeline.get_process_attrs(task.get_value('process'))
             
                 td.add_attr('spt_pipeline_code', attrs.get('%s_login_group'%my.get_name()))
         except SObjectSecurityException, e:
             pass
         except SearchException, e:
             if e.__str__().find('not registered') != -1:
                 pass
             elif e.__str__().find('does not exist for database') != -1:
                 pass    
             elif e.__str__().find('Cannot find project') != -1:
                 pass
             else:
                 raise
开发者ID:0-T-0,项目名称:TACTIC,代码行数:34,代码来源:process_group_select_wdg.py

示例12: get_my_sobject

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_search_key [as 别名]
 def get_my_sobject(my):
     sobject = my.get_current_sobject()
     if not my.search_key:
         search_id = my.web.get_form_value('search_id')
         if search_id != '-1':
             my.search_key = my.get_search_key()
             sobject = Search.get_by_search_key(my.search_key)
     return sobject
开发者ID:0-T-0,项目名称:TACTIC,代码行数:10,代码来源:creator_wdg.py

示例13: get_my_sobject

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import get_by_search_key [as 别名]
 def get_my_sobject(self):
     sobject = self.get_current_sobject()
     if not self.search_key:
         search_id = self.web.get_form_value('search_id')
         if search_id != '-1':
             self.search_key = self.get_search_key()
             sobject = Search.get_by_search_key(self.search_key)
     return sobject
开发者ID:mincau,项目名称:TACTIC,代码行数:10,代码来源:creator_wdg.py

示例14: get_display

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

        path = my.kwargs.get("path")
        md5 = my.kwargs.get("md5")
        snapshot_code = my.kwargs.get("snapshot_code")

        top = my.top
        top.add_style("padding: 10px")
        top.add_color("background", "background", -5)

        path_div = DivWdg()
        top.add(path_div)
        path_div.add("<b>Local Path: %s</b><br/>" % path)
        path_div.add_style("font-size: 12px")
        path_div.add_style("margin-bottom: 10px")

        info_wdg = DivWdg()
        info_wdg.add_color("background", "background3")
        top.add(info_wdg)
        info_wdg.add("md5: %s<br/>" % md5)
        info_wdg.add("snapshot_code: %s<br/>" % snapshot_code)
        info_wdg.add_style("padding: 5px")


        search_key = my.kwargs.get("search_key")
        sobject = Search.get_by_search_key(search_key)


        # bit of a hack get the file system paths
        #spath = Common.get_filesystem_name(path)
        spath = path.replace(" ", "_")
        search = Search("sthpw/file")
        search.add_sobject_filter(sobject)
        search.add_filter("source_path", spath)
        search.add_order_by("timestamp desc")
        files = search.get_sobjects()

        '''
        files_div = DivWdg()
        files_div.add_style("margin: 5px")
        files_div.add_style("padding: 5px")
        files_div.add_border()

        top.add(files_div)
        '''
        snapshots = []
        for file in files:
            snapshot = file.get_parent()
            snapshots.append(snapshot)

        from tactic.ui.panel import StaticTableLayoutWdg
        table = StaticTableLayoutWdg(search_type="sthpw/snapshot", view="table", show_shelf=False)
        table.set_sobjects(snapshots)
        top.add(table)



        return top
开发者ID:0-T-0,项目名称:TACTIC,代码行数:60,代码来源:file_properties_wdg.py

示例15: execute

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

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

        collection = Search.get_by_search_key(collection_key)
        if not collection:
            raise Exception("Collection does not exist")


        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()


        search_codes = [x.get_value("search_code") for x in items]
        search_codes = set(search_codes)



        has_keywords = SearchType.column_exists(search_type, "keywords")

        if has_keywords:
            collection_keywords = collection.get_value("keywords", no_exception=True)
            collection_keywords = collection_keywords.split(" ")
            collection_keywords = set(collection_keywords)



        # create new items

        sobjects = Search.get_by_search_keys(search_keys)
        for sobject in sobjects:
            if sobject.get_code() in search_codes:
                continue

            new_item = SearchType.create(collection_type)
            new_item.set_value("parent_code", collection.get_code())
            new_item.set_value("search_code", sobject.get_code())
            new_item.commit()


            # copy the metadata of the collection
            if has_keywords:
                keywords = sobject.get_value("keywords")

                keywords = keywords.split(" ")
                keywords = set(keywords)

                keywords = keywords.union(collection_keywords)
                keywords = " ".join(keywords)

                sobject.set_value("keywords", keywords)
                sobject.commit()
开发者ID:asmboom,项目名称:TACTIC,代码行数:59,代码来源:collection_wdg.py


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