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


Python Search.add_order_by方法代码示例

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


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

示例1: get_client_img

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

示例2: preprocess

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

示例3: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_order_by [as 别名]
    def get_display(my):
        widget = DivWdg(id='link_view_select')
        widget.add_class("link_view_select")
        if my.refresh:
            widget = Widget()
        else:
            my.set_as_panel(widget)
        
        views = []
        if my.search_type:
            from pyasm.search import WidgetDbConfig
            search = Search( WidgetDbConfig.SEARCH_TYPE )
            search.add_filter("search_type", my.search_type)
            search.add_regex_filter("view", "link_search:|saved_search:", op="NEQI")
            search.add_order_by('view')
            widget_dbs = search.get_sobjects()
            views = SObject.get_values(widget_dbs, 'view')
        
        labels = [view for view in views]

        views.insert(0, 'table')
        labels.insert(0, 'table (Default)')
        st_select = SelectWdg('new_link_view', label='View: ')
        st_select.set_option('values', views)
        st_select.set_option('labels', labels)
        widget.add(st_select)
        return widget
开发者ID:blezek,项目名称:TACTIC,代码行数:29,代码来源:view_manager_wdg.py

示例4: _get_next_num

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

        # set the default
        code_num = 1

        # get the highest number, extract the number and increase by 1
        search_type = my.sobject.get_search_type()
        search = Search(search_type)
        search.set_show_retired_flag(True)

        for column in columns:
            value = my.sobject.get_value(column)
            search.add_filter(column, value)

        # order by descending codes
        search.add_order_by("code desc")
       
        sobject = search.get_sobject()

        if sobject != None:
            code = sobject.get_value("code")

            naming = Project.get_code_naming(sobject, code)
            code_num = naming.get_match("padding")
            code_num = int(code_num) + 1

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

示例5: get_new_code

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

示例6: get_subscriptions

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_order_by [as 别名]
    def get_subscriptions(my, category, mode="new"):

        search = Search("sthpw/subscription")
        search.add_user_filter()
        if category:
            search.add_filter("category", category)



        if mode == "new":
            search.add_op("begin")
            search.add_filter("last_cleared", '"message"."timestamp"', quoted=False, op="<")
            search.add_filter("last_cleared", "NULL", quoted=False, op="is")
            search.add_op("or")


            #project_code = Project.get_project_code()
            #search.add_filter("project_code", project_code )

            # use an inner join because if there are no messages, we don't
            # want the subscription
            search.add_order_by("message.timestamp", direction="desc", join="INNER")

            # don't show user message except when category is certain values
            user = Environment.get_user_name()
            search.add_op("begin")
            search.add_filter("login", user, op="!=", table="message")
            search.add_filters("category", ["script","default","sobject"], table="message")
            search.add_op("or")
        else:
            search.add_order_by("message.timestamp", direction="desc")

        subscriptions = search.get_sobjects()

        return subscriptions
开发者ID:hellios78,项目名称:TACTIC,代码行数:37,代码来源:message_wdg.py

示例7: preprocess

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

        sobjects = self.sobjects
        if not sobjects:
            return

        # find all of the instances in a shot
        sobject = sobjects[0]
        foreign_key = sobject.get_foreign_key()

        search_type = WebState.get().get_state("planner_search_type")
        search = Search( search_type )

        search.add_column(foreign_key)

        if len(sobjects) == 1:
            search.add_filter(foreign_key, sobject.get_code())
        else:
            search_codes = [x.get_code() for x in sobjects]
            search.add_filters(foreign_key, search_codes)

        search_type = sobject.get_search_type()
        search.add_order_by(foreign_key)
        children = search.get_sobjects()

        # convert to a dictionary
        for child in children:
            code = child.get_value(foreign_key)
            number = self.numbers.get(code)
            if not number:
                number = 0
           
            number += 1
            self.numbers[code] = number
开发者ID:mincau,项目名称:TACTIC,代码行数:36,代码来源:sobject_planner_wdg.py

示例8: get_display

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

        widget = Widget()

        # get all of the sources, add reverse timestamp order
        search = Search("prod/texture_source")
        search.add_order_by("timestamp")
        search.set_limit(10)
        sources = search.get_sobjects()

        if sources:
            widget.add(HtmlElement.b("Predefined Sources:"))
            widget.add(HtmlElement.br())
            for source in sources:
                search_key = source.get_search_key()
                checkbox = CheckboxWdg("predefined_source")
                checkbox.set_option("value",search_key)
                widget.add(checkbox)
                widget.add(source.get_value("code"))
                widget.add(SpanWdg("&gt;&gt;", css='med'))
                widget.add(source.get_value("description"))
                widget.add("<br/>")



        # or add a new one
        widget.add(HtmlElement.b("New Source:"))
        upload_wdg = SimpleUploadWdg("add_source")
        widget.add(upload_wdg)

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

示例9: get_display

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

示例10: get_security_wdg

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

        div = DivWdg()
        div.add_class("spt_security")

        div.add("A server can sync either be scoped for a single project or all projects.  Transactions that occur in the admin project never get synced.")

        div.add("<br/>"*2)

        div.add("Project: ")

        search = Search("sthpw/project")
        search.add_filters("code", ['admin','unittest'], op='not in')
        search.add_order_by("title")
        projects = search.get_sobjects()

        select = SelectWdg("projects")
        div.add(select)
        labels = [x.get_value("title") for x in projects]
        values = [x.get_value("code") for x in projects]

        project_code = Project.get_project_code()
        if project_code != 'admin':
            select.set_value(project_code)
        select.set_option("labels", labels)
        select.set_option("values", values)
        select.add_empty_option("-- All --")


        div.add("<br/>"*2)

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

示例11: execute

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_order_by [as 别名]
    def execute(my):
        input = my.get_input()
        mode = input.get("mode")
        # NOTE: this could be run during update and insert of snapshot
        # during insert, for simple snapshot creation like server.create_snaphot()
        # during update, is_latest, is_current and update_versionless are handled together for check-in

        if mode in ["delete", "retire"]:
            sobject_dict = input.get("sobject")
            context = sobject_dict.get("context")
            search_type = sobject_dict.get("search_type")
            search_code = sobject_dict.get("search_code")
            search_id = sobject_dict.get("search_id")

            search = Search("sthpw/snapshot")
            search.add_filter("context", context)
            search.add_order_by("timestamp desc")

            search.add_filter("search_type", search_type)
            if search_code:
                search.add_filter("search_code", search_code)
            else:
                search.add_filter("search_id", search_id)

            snapshots = search.get_sobjects()
            for i, snapshot in enumerate(snapshots):
                if i == 0:
                    if snapshot.get_value("is_latest") == False:
                        snapshot.set_value("is_latest", True)
                        snapshot.update_versionless("latest")
                        snapshot.commit()
                else:
                    if snapshot.get_value("is_latest") == True:
                        snapshot.set_value("is_latest", False)
                        snapshot.commit()

                # NOTE: not sure what to do with is_current when the
                # current snapshot is deleted

            return

        sobject_dict = input.get("sobject_dict")
        search_key = input.get("search_key")
        snapshot = Search.get_by_search_key(search_key)

        # print "mode: ", mode
        # print "snapshot: ", snapshot.get("version"), snapshot.get("context")
        # print "data: ", input.get("update_data").keys()
        # print

        # if the current snapshot is already the latest, don't do anything
        update_data = input.get("update_data")
        update_versionless = mode == "update"

        if update_data.get("is_latest") == True:
            snapshot.set_latest(commit=True, update_versionless=update_versionless)

        if update_data.get("is_current") == True:
            snapshot.set_current(commit=True, update_versionless=update_versionless)
开发者ID:jayvdb,项目名称:TACTIC,代码行数:61,代码来源:trigger.py

示例12: execute

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_order_by [as 别名]
    def execute(my):
        input = my.get_input()
        mode = input.get("mode")

        if mode in ['delete','retire']:
            sobject_dict = input.get("sobject")
            context = sobject_dict.get("context")
            search_type = sobject_dict.get("search_type")
            search_code = sobject_dict.get("search_code")
            search_id = sobject_dict.get("search_id")

            search = Search("sthpw/snapshot")
            search.add_filter("context", context)
            search.add_order_by("timestamp desc")

            search.add_filter("search_type", search_type)
            if search_code:
                search.add_filter("search_code", search_code)
            else:
                search.add_filter("search_id", search_id)

            snapshots = search.get_sobjects()
            for i, snapshot in enumerate(snapshots):
                if i == 0:
                    if snapshot.get_value("is_latest") == False:
                        snapshot.set_value("is_latest", True)
                        snapshot.update_versionless("latest")
                        snapshot.commit()
                else:
                    if snapshot.get_value("is_latest") == True:
                        snapshot.set_value("is_latest", False)
                        snapshot.commit()

                # NOTE: not sure what to do with is_current when the
                # current snapshot is deleted

            return


        sobject_dict = input.get("sobject_dict")
        search_key = input.get("search_key")
        snapshot = Search.get_by_search_key(search_key)


        #print "mode: ", mode
        #print "snapshot: ", snapshot.get("version"), snapshot.get("context")
        #print "data: ", input.get("update_data").keys()
        #print


        # if the current snapshot is already the latest, then don't bother
        # doing anything
        update_data = input.get("update_data")
        if update_data.get("is_latest") == True:
            snapshot.set_latest(commit=True)


        if update_data.get("is_current") == True:
            snapshot.set_current(commit=True)
开发者ID:blezek,项目名称:TACTIC,代码行数:61,代码来源:trigger.py

示例13: get_by_search_type

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

        search = Search(Template.SEARCH_TYPE)
        search.add_filter("search_type", search_type)

        search.add_order_by("timestamp desc")

        return search.do_search()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:10,代码来源:template.py

示例14: get_display

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

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_order_by [as 别名]
    def get_search_types(my, include_sthpw=False, include_config=False, include_multi_project=False):
        '''get all the search types in this project'''
        if my.search_types != None:
            return my.search_types

        project_type = my.get_value("type")

        search = Search("sthpw/search_object")

        project_code = my.get_code()
        namespaces = [project_code]
        namespaces.append(project_type)

        if include_sthpw:
            namespaces.append("sthpw")
        if include_config:
            namespaces.append("config")
        if include_multi_project:
            if not include_config:
                search.add_filter('namespace','config',op='!=')
            if not include_sthpw:
                search.add_filter('namespace','sthpw',op='!=')
            search.add_op('begin')
            search.add_filter('database','{project}')
            

        search.add_filters("namespace", namespaces)

        if include_multi_project:
            search.add_op('or')

        search.add_order_by("search_type")
        search_type_objs = search.get_sobjects()

        """
        from pyasm.biz import Schema
        schema = Schema.get()
        xml = schema.get_xml_value("schema")
        search_types = xml.get_values("schema/search_type/@name")
        search = Search("sthpw/search_object")
        search.add_filters("code", search_types)
        search_type_objs = search.get_sobjects()
        """



        search_types = []
        for x in search_type_objs:
            # to avoid the old ill-defined prod/custom_property defined in sthpw namespace
            if (x.get_value('namespace') == 'sthpw' and x.get_value('search_type').find('custom_property') == -1)\
                or my.has_table(x):
                search_types.append(x)
        return search_types
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:55,代码来源:project.py


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