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


Python Search.add_where方法代码示例

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


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

示例1: get_deliverable_files_in_order

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

示例2: get_new_code

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

        related_code = related_asset.get_value("code")
        related_type = my.get_value("type")
        if not related_type:
            raise UserException("Suffix (define the list by clicking on the edit icon) cannot be empty")
        # find all of the other related assets that match
        search = Search("prod/asset")
        search.add_where("code like '%s_%s%%'" % (related_code,related_type))
        search.add_order_by("code desc" )
        last_asset = search.get_sobject()
        if last_asset:
            last_code = last_asset.get_code()
            # get the related index
            if my.search_type == 'flash/asset':
                from pyasm.flash import FlashCodeNaming 
                naming = FlashCodeNaming(last_asset, last_code)
            elif my.search_type == 'prod/asset':
                from pyasm.prod.biz import ProdAssetCodeNaming 
                naming = ProdAssetCodeNaming(last_asset, last_code)
            related_index = naming.get_related_index()
        else:
            related_index = 0

        # build up the code
        new_code = '%s_%s%02d' % \
            (related_code, related_type, related_index+1)
        return new_code
开发者ID:0-T-0,项目名称:TACTIC,代码行数:30,代码来源:related_asset_wdg.py

示例3: get_groups_by_code

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_where [as 别名]
 def get_groups_by_code(note_code):
     group_note = SearchType.get(GroupNotification.SEARCH_TYPE)
     
     search = Search(LoginGroup.SEARCH_TYPE)
     search.add_where('''"login_group" in (select "login_group" from "%s" where "notification_code" = '%s')''' %(group_note.get_table(), note_code))
         
     return search.get_sobjects()
开发者ID:mincau,项目名称:TACTIC,代码行数:9,代码来源:notification.py

示例4: get_tasks

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_where [as 别名]
    def get_tasks(hot_items):
        """
        Given a list of 'titles', return all the tasks associated with those titles. Return only those marked as
        'active' and that are not marked as 'completed'.

        :param hot_items: A list of titles from 'twog/title'
        :return: List of tasks
        """
        title_codes = []

        for item in hot_items:
            title_codes.append("'{0}'".format(item.get_value('code')))

        title_codes_string = ','.join(title_codes)

        task_search = Search("sthpw/task")
        task_search.add_filter('bigboard', True)
        task_search.add_filter('active', '1')
        task_search.add_filter('search_type', 'twog/proj?project=twog')
        task_search.add_filter('status', 'Completed', op="!=")

        task_search.add_where('\"title_code\" in ({0})'.format(title_codes_string))

        task_search_results = task_search.get_sobjects()

        return task_search_results
开发者ID:2gDigitalPost,项目名称:custom,代码行数:28,代码来源:hottoday.py

示例5: get_input_snapshots

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

示例6: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_where [as 别名]
    def get_display(my):
        
        #defining init is better than get_display() for this kind of SelectWdg
        search = Search( SearchType.SEARCH_TYPE )
        
        if my.mode == None or my.mode == my.ALL_BUT_STHPW:
            # always add the login / login group search types
            filter = search.get_regex_filter("search_type", "login|task|note|timecard|trigger|milestone", "EQ")
            no_sthpw_filter = search.get_regex_filter("search_type", "^(sthpw).*", "NEQ")   
            search.add_where('%s or %s' %(filter, no_sthpw_filter))
        elif my.mode == my.CURRENT_PROJECT:
            project = Project.get()
            project_code = project.get_code()
            #project_type = project.get_project_type().get_type()
            project_type = project.get_value("type")
            search.add_where("\"namespace\" in ('%s','%s') " % (project_type, project_code))

        
        search.add_order_by("search_type")

        search_types = search.get_sobjects()
        values = SObject.get_values(search_types, 'search_type')
        labels = [ x.get_label() for x in search_types ]
        values.append('CustomLayoutWdg')
        labels.append('CustomLayoutWdg')
        my.set_option('values', values)
        my.set_option('labels', labels)
        #my.set_search_for_options(search, "search_type", "get_label()")
        my.add_empty_option(label='-- Select Search Type --')

        return super(SearchTypeSelectWdg, my).get_display()
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:33,代码来源:misc_input_wdg.py

示例7: get_display

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

        web = WebContainer.get_web()
        search_type = web.get_form_value("browser_search_type")
        search_text = web.get_form_value("browser_search_text")

        div = DivWdg()

        if search_type.startswith("prod/shot"):
            filter = self.get_filter(search_text, ['code','description'])
        elif search_type.startswith("prod/art_reference"):
            filter = self.get_filter(search_text, ['category','description'])
        else:
            filter = self.get_filter(search_text, ['name','code','description'])
        if not filter:
            return div

        search = Search(search_type)

        search.add_where(filter)

        div.add_style("width: 300")
        div.add_style("height: 200")
        div.add_style("overflow: auto")
        table = TableWdg(search_type, "list", css="minimal")
        table.set_show_property(False)
        table.set_sobjects(search.get_sobjects())
        div.add(table)

        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:32,代码来源:sobject_browser_wdg.py

示例8: get_potential_origin_files

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

示例9: get_camera_wdg

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_where [as 别名]
    def get_camera_wdg(self):
        widget = Widget()

        div = DivWdg(css="filter_box")
        sequence_filter = SequenceFilterWdg()
        epi_code, sequence_code = sequence_filter.get_value()
        div.add(sequence_filter)

        search = Search("prod/camera")

        columns = ['shot_code', 'description']
        search_filter = SearchFilterWdg("camera_search", columns=columns,\
            has_persistence=False)
     
        search_filter.alter_search(search)
        div.add(search_filter)
        widget.add(div)

        if sequence_code:
            search.add_where("shot_code in (select code from shot where sequence_code = '%s')" % sequence_code)

        table = TableWdg("prod/camera")
        table.set_search(search)
        widget.add(table)
        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:27,代码来源:preprod_tab_wdg.py

示例10: get_client_img

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_where [as 别名]
def get_client_img(client_code):
    img_path = ''
    client_search = Search("twog/client")
    client_search.add_filter('code', client_code)
    client_search_object = client_search.get_sobject()

    if client_search_object:
        client_id = client_search_object.get_id()

        snaps_s = Search("sthpw/snapshot")
        snaps_s.add_filter('search_id', client_id)
        snaps_s.add_filter('search_type', 'twog/client?project=twog')
        snaps_s.add_filter('is_current', '1')
        snaps_s.add_filter('version', '0', op='>')
        snaps_s.add_where("\"context\" in ('publish','icon','MISC')")
        snaps_s.add_order_by('timestamp desc')
        snaps = snaps_s.get_sobjects()

        if len(snaps) > 0:
            server = TacticServerStub.get()
            snap = snaps[0]
            img_path = server.get_path_from_snapshot(snap.get_code(), mode="web")

            if img_path:
                img_path = 'http://' + server.get_server_name() + img_path
        return img_path
    else:
        return None
开发者ID:2gDigitalPost,项目名称:custom,代码行数:30,代码来源:hottoday_utils.py

示例11: get_count

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_where [as 别名]
 def get_count(cls, where=None, category=None):
     search = Search(Clipboard)
     search.add_user_filter()
     if not category:
         search.add_filter("category","select")
     if where:
         search.add_where(where)
     return search.get_count()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:10,代码来源:clipboard.py

示例12: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_where [as 别名]
    def get_display(my):
        widget = Widget()
        span = SpanWdg('[ projects ]', css='hand')
        span.add_style('color','white')
        span.add_event('onclick',"spt.show_block('%s')" %my.WDG_ID)
        widget.add(span)
        
        # add the popup
        div = DivWdg(id=my.WDG_ID, css='popup_wdg')
        widget.add(div)
        div.add_style('width', '80px')
        div.add_style('display', 'none')
        title_div = DivWdg()
        div.add(title_div)
        title = FloatDivWdg(' ', width='60px')
        title.add_style('margin-right','2px')
        title_div.add_style('padding-bottom', '4px')
        title_div.add(title)
        title_div.add(CloseWdg(my.get_off_script(), is_absolute=False))


        div.add(HtmlElement.br())
        
        search = Search(Project)
        search.add_where("\"code\" not in ('sthpw','admin')")
        search.add_column('code')
        projects = search.get_sobjects()
        values = SObject.get_values(projects, 'code')

        web = WebContainer.get_web()
        root = web.get_site_root()
        
        
        security = Environment.get_security()
        for value in values:
            if not security.check_access("project", value, "view"):
                continue
            script = "location.href='/%s/%s'"%(root, value)
            sub_div = DivWdg(HtmlElement.b(value), css='selection_item') 
            sub_div.add_event('onclick', script)
            div.add(sub_div)
        
        div.add(HtmlElement.hr())
        if security.check_access("project", 'default', "view"):
            script = "location.href='/%s'" % root
            sub_div = DivWdg('home', css='selection_item') 
            sub_div.add_event('onclick', script)
            div.add(sub_div)

        if security.check_access("project", "admin", "view"):
            script = "location.href='/%s/admin/'" %root
            sub_div = DivWdg('admin', css='selection_item') 
            sub_div.add_event('onclick', script)
            div.add(sub_div)

       

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

示例13: get_items

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_where [as 别名]
 def get_items(my):
     if not my.item_sobj:
         return []
     search = Search( my.item_cls )
     query = "%s in (select %s from %s where \
         %s = '%s')" % (my.item_sobj.get_primary_key(), \
         my.item_sobj.get_foreign_key(), \
         SearchType.get(my.grouping_cls).get_table(),\
         my.group.get_foreign_key(),\
         my.group.get_value(my.group.get_primary_key()))
     
     search.add_where(query)    
     return search.get_sobjects()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:15,代码来源:sobject_group_wdg.py

示例14: get_logins_by_id

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_where [as 别名]
 def get_logins_by_id(note_id):
     login_in_group = SearchType.get(LoginInGroup.SEARCH_TYPE)
     group_note = SearchType.get(GroupNotification.SEARCH_TYPE)
     search = Search(Login.SEARCH_TYPE)
     query_str = ''
     
     if isinstance(note_id, list):
         query_str = "in (%s)" %",".join([str(id) for id in note_id])
     else:
         query_str = "= %d" %note_id
     search.add_where('''"login" in (select "login" from "%s" where "login_group" in (select "login_group" from "%s" where "notification_id" %s)) ''' % (login_in_group.get_table(), group_note.get_table(), query_str))
         
         
     return search.get_sobjects()
开发者ID:mincau,项目名称:TACTIC,代码行数:16,代码来源:notification.py

示例15: get_display

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

        widget = Widget()

        div = DivWdg(css="filter_box")

        show_span = SpanWdg(css="med")
        show_span.add("Show All Types: ")
        checkbox = FilterCheckboxWdg("show_all_types")
        checkbox.set_persistence()
        show_span.add(checkbox)
        show_all_types = checkbox.get_value()
        div.add(show_span)

        span = SpanWdg(css="med")
        span.add("Search Type: ")

        select = SelectWdg("filter|search_type")
        select.add_empty_option("-- Select --")
        project = Project.get()
        project_type = project.get_base_type()
        search = Search("sthpw/search_object")
        if show_all_types:
            search.add_where(
                """
            namespace = '%s' or namespace = '%s' or search_type in ('sthpw/task')
            """
                % (project_type, project.get_code())
            )
        else:
            # show only the custom ones
            search.add_filter("namespace", project.get_code())

        search.add_order_by("title")
        sobjects = search.get_sobjects()

        select.set_sobjects_for_options(sobjects, "search_type", "title")
        # select.set_option("query", "sthpw/search_object|search_type|title")
        select.set_persistence()
        select.add_event("onchange", "document.form.submit()")
        search_type = select.get_value()
        span.add(select)
        div.add(span)

        # make sure the current selection exists
        try:
            SearchType.get(search_type)
        except SearchException, e:
            return div
开发者ID:hellios78,项目名称:TACTIC,代码行数:51,代码来源:custom_view_app_wdg.py


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