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


Python biz.Schema类代码示例

本文整理汇总了Python中pyasm.biz.Schema的典型用法代码示例。如果您正苦于以下问题:Python Schema类的具体用法?Python Schema怎么用?Python Schema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: _get_result

    def _get_result(my, sobject):

        # get the parent or relation
        column = my.get_column()
        parent_id = sobject.get_value(column)
        parent = my.parents_dict.get(parent_id)
        if not parent:
            return super(ForeignKeyElementWdg,my).get_display()


        template = my.get_option('template')
        # if not set, then look at the schema
        if not template:
            schema = Schema.get_by_project_code( Project.get_project_code() )
            search_type = parent.get_base_search_type()
            template = schema.get_attr_by_search_type(search_type,'display_template')

        if template:
            value = NamingUtil.eval_template(template, sobject, parent=parent)
        else:
            # NOTE: put something ... anything as a default
            columns = parent.get_search_type_obj().get_columns()
            if not len(columns):
                value = parent.get_value(columns[0])
            else:
                value = parent.get_value(columns[1])

        return value
开发者ID:0-T-0,项目名称:TACTIC,代码行数:28,代码来源:foreign_key_element_wdg.py

示例2: get_related_types

    def get_related_types(self, search_type):
        # find all the relationships
        schema = Schema.get()
        related_types = schema.get_related_search_types(search_type)
        parent_type = schema.get_parent_type(search_type)
        child_types = schema.get_child_types(search_type)


        # some special considerations
        # FIXME: this needs to be more automatic.  Should only be
        # deletable children (however, that will be defined)
        if search_type in ['sthpw/task','sthpw/note', 'sthpw/snapshot']:
            if "sthpw/project" in related_types:
                related_types.remove("sthpw/project")

            if "sthpw/login" in related_types:
                related_types.remove("sthpw/login")

            if "config/process" in related_types:
                related_types.remove("config/process")


        if parent_type in related_types:
            related_types.remove(parent_type)

        related_types.append('sthpw/note')
        related_types.append('sthpw/task')
        related_types.append('sthpw/snapshot')
        related_types.append('sthpw/work_hour')
        related_types.append('sthpw/pipeline')
        related_types.append('sthpw/sobject_list')

        return related_types
开发者ID:mincau,项目名称:TACTIC,代码行数:33,代码来源:delete_wdg.py

示例3: get_display

    def get_display(self):

        #project = Project.get()
        schema = Schema.get()
        # no hierarchy to prevent all sthpw and parent sTypes 
        search_type_names = schema.get_search_types(hierarchy=False)
        search = Search('sthpw/search_object')
        search.add_filters('search_type', search_type_names)
        search_types = search.get_sobjects()

        task_search_type = SearchType.get("sthpw/task")
        search_types.append(task_search_type)

        values = [ x.get_value("search_type") for x in search_types]
        labels = []
        for x in search_types:
            label = "%s (%s)" % (x.get_value("title"), x.get_value("search_type"))
            labels.append(label)


        sobject = self.get_current_sobject()
        if not sobject:
            value = ""
        else:
            value = sobject.get_value(self.get_name() )

        self.set_option("values", values)
        self.set_option("labels", labels)
        self.add_empty_option("-- Select --")
        if value:
            self.set_value(value)

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

示例4: get_hier_sel

    def get_hier_sel(my, search_type):
        sel = SelectWdg(my.RELATED_SEARCH_TYPE, label='Related Search Type: ')
        sel.add_empty_option()
        schema = Schema.get()
        search_type_list = [search_type]
        if schema:
            parent_search_type = schema.get_parent_type(search_type)
            if parent_search_type:
                search_type_list.append(parent_search_type)
            child_types = schema.get_child_types(search_type)
            search_type_list.extend(child_types)

        sel.set_option('values', search_type_list)

        sel.set_value(my.related_search_type)
        return sel
开发者ID:0-T-0,项目名称:TACTIC,代码行数:16,代码来源:filter_wdg.py

示例5: init

    def init(my):
        my.schema = Schema.get()
        if not my.schema:
            my.parent_type = None
            my.select = None
            return

        web = WebContainer.get_web()
        my.search_type = web.get_form_value("filter|search_type")
        if not my.search_type:
            search_type = my.options.get("search_type")

        my.parent_type = my.schema.get_parent_type(my.search_type)
        if not my.parent_type:
            my.select = None
        else:
            my.select = FilterSelectWdg("filter|%s" % my.parent_type)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:17,代码来源:filter_wdg.py

示例6: _test_relationship

    def _test_relationship(my):

        search_type = "table/posts?project=mongodb"
        search_type2 = "table/posts2?project=mongodb"

        from pyasm.biz import Schema
        schema = Schema.get()

        relationship = schema.get_relationship(search_type, search_type2)
        my.assertEquals(None, relationship)

        search_type2 = "sthpw/task"
        relationship = schema.get_relationship(search_type, search_type2)
        my.assertEquals("search_id", relationship)

        attrs = schema.get_relationship_attrs(search_type, search_type2)
        my.assertEquals("*", attrs.get("to") )
        my.assertEquals("search_type", attrs.get("relationship") )
开发者ID:0-T-0,项目名称:TACTIC,代码行数:18,代码来源:mongodb_test.py

示例7: get_display

    def get_display(my):

        #project = Project.get()
        schema = Schema.get()
        # no hierarchy to prevent all sthpw and parent sTypes 
        search_type_names = schema.get_search_types(hierarchy=False)
        search = Search('sthpw/search_object')
        search.add_filters('search_type', search_type_names)
        search_types = search.get_sobjects()

        task_search_type = SearchType.get("sthpw/task")
        search_types.append(task_search_type)

        values = [ x.get_value("search_type") for x in search_types]
        filtered = []
        labels = []
        for x in search_types:
            base_type = x.get_base_key()
            exists = SearchType.column_exists(base_type, "pipeline_code")
            if not exists:
                continue

            label = "%s (%s)" % (x.get_value("title"), x.get_value("search_type"))
            labels.append(label)
            filtered.append(base_type)


        values = filtered

        sobject = my.get_current_sobject()
        if not sobject:
            value = ""
        else:
            value = sobject.get_value(my.get_name() )

        my.set_option("values", values)
        my.set_option("labels", labels)
        my.add_empty_option("-- Select --")
        if value:
            my.set_value(value)

        return super(SearchTypeWithPipelineInputWdg, my).get_display()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:42,代码来源:search_type_input_wdg.py

示例8: execute

    def execute(self):

        # if a single sobject is passed in
        sobject = self.kwargs.get("sobject")
        if not sobject:
            search_key = self.kwargs.get("search_key")
            sobject = Search.get_by_search_key(search_key)

        if sobject:
            sobjects = [sobject]
        else:
            search_keys = self.kwargs.get("search_keys")
            sobjects = Search.get_by_search_keys(search_keys)

        if not sobjects:
            return


        # find all the relationships
        self.schema = Schema.get()

        for sobject in sobjects:
            self.delete_sobject(sobject)
开发者ID:mincau,项目名称:TACTIC,代码行数:23,代码来源:delete_wdg.py

示例9: _get_predefined_url

    def _get_predefined_url(cls, key, hash):

        # make some predefined fake urls
        if key in ["link", "tab", "admin"]:
            # this is called by PageNav
            if key == "admin":
                expression = "/admin/link/{link}"
            else:
                expression = "/%s/{link}" % key
            options = Common.extract_dict(hash, expression)
            link = options.get("link")

            if not link:
                return None


            # test link security
            project_code = Project.get_project_code()
            security = Environment.get_security()
            keys = [
                    { "element": link },
                    { "element": "*" },
                    { "element": link, "project": project_code },
                    { "element": "*", "project": project_code }
            ]
            if not security.check_access("link", keys, "allow", default="deny"):
                return None


            from tactic.ui.panel import SideBarBookmarkMenuWdg
            personal = False
            if '.' in link:
                personal = True



            config = SideBarBookmarkMenuWdg.get_config("SideBarWdg", link, personal=personal)
            options = config.get_display_options(link)
            if not options:

                from pyasm.biz import Schema
                config_xml = []
                config_xml.append( '''
                <config>
                ''')
         
                config_schema = Schema.get_predefined_schema('config')
                SideBarBookmarkMenuWdg.get_schema_snippet("_config_schema", config_schema, config_xml)
                schema = Schema.get_admin_schema()
                SideBarBookmarkMenuWdg.get_schema_snippet("_admin_schema", schema, config_xml)

                config_xml.append( '''
                </config>
                ''')

                xml = "".join(config_xml)

                from pyasm.widget import WidgetConfig
                schema_config = WidgetConfig.get(view="_admin_schema", xml=xml)
                options = schema_config.get_display_options(link)
                if not options:
                    schema_config.set_view("_config_schema")
                    options = schema_config.get_display_options(link)

                if not options:
                    return None




            class_name = options.get("class_name")
            widget_key = options.get("widget_key")
            if widget_key:
                class_name = WidgetClassHandler().get_display_handler(widget_key)
            elif not class_name:
                class_name = 'tactic.ui.panel.ViewPanelWdg'


            if key in ["admin", "tab"]:
                use_index = "false"
            else:
                use_index = "true"

            if key in ['admin']:
                use_admin = "true"
            else:
                use_admin = "false"


            xml = []
            xml.append('''<element admin="%s" index="%s">''' % (use_admin, use_index))
            xml.append('''  <display class="%s">''' % class_name)
            for name, value in options.items():
                xml.append("<%s>%s</%s>" % (name, value, name) )
            xml.append('''  </display>''')
            xml.append('''</element>''')

            xml = "\n".join(xml)

            sobject = SearchType.create("config/url")
#.........这里部分代码省略.........
开发者ID:lucasnemeth,项目名称:TACTIC,代码行数:101,代码来源:hash_panel_wdg.py

示例10: import_manifest

    def import_manifest(my, nodes):
        paths_read = []

        for node in nodes:

            node_name = my.xml.get_node_name(node)
            if node_name == 'search_type':
                search_type = my.xml.get_attribute(node, 'code')

                # implicitly add the entry to the schema table.
                # Reset the cache every time to ensure that any updates to
                # the scehma are reflected here.
                schema = Schema.get(reset_cache=True)
                xml = schema.get_xml()
                schema_node = xml.get_node("schema/search_type[@name='%s']" % search_type)
                parent = xml.get_node("schema")
                if schema_node == None:
                    schema_node = xml.create_element("search_type")
                    xml.set_attribute(schema_node, "name", search_type)

                    #parent = xml.get_parent(node)
                    xml.append_child(parent, schema_node)
                    schema.set_value('schema', xml.to_string() )
                    schema.commit()

                    # TODO: connections?

                path = my.xml.get_attribute(node, "path")
                if not path:
                    path = "%s.spt" % search_type.replace("/", "_")

                path = "%s/%s" % (my.plugin_dir, path)

                if path in paths_read:
                    continue

                if my.verbose:
                    print "Reading search_type: ", path

                # NOTE: priviledged knowledge of the order or return values
                jobs = my.import_data(path, commit=True)

                paths_read.append(path)

                if not jobs:
                    continue

                search_type_obj = jobs[0]

                if len(jobs) == 1:
                    # only the search type was defined
                    table = None
                else:
                    table = jobs[1]


                try:
                    # check to see if the search type already exists
                    search_type_chk = SearchType.get(search_type)
                    if search_type_chk:
                        if my.verbose:
                            print 'WARNING: Search Type [%s] is already registered' % search_type_chk.get_value("search_type")
                    else:
                        search_type_obj.commit()
                except SearchException, e:
                    if e.__str__().find('not registered') != -1:
                        search_type_obj.commit()

                # check if table exists 
                has_table = False
                if has_table:
                    if my.verbose:
                        print 'WARNING: Table [%s] already exists'
                elif table:
                    #print table.get_statement()
                    if table:
                        database = table.get_database()
                        table_name = table.get_table()

                        TableUndo.log(search_type, database, table_name)




            elif node_name == 'sobject':
                path = my.xml.get_attribute(node, "path")
                search_type = my.xml.get_attribute(node, "search_type")
                seq_max = my.xml.get_attribute(node, "seq_max")
                try:
                    if seq_max:
                        seq_max = int(seq_max)
                except ValueError:
                    seq_max = 0

                if not path:
                    if search_type:
                        path = "%s.spt" % search_type.replace("/","_")
                if not path:
                    raise TacticException("No path specified")

#.........这里部分代码省略.........
开发者ID:talha81,项目名称:TACTIC-DEV,代码行数:101,代码来源:plugin.py

示例11: get_display


#.........这里部分代码省略.........
        # tasks
        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("padding-left: 5px")
        td.add_style("border-right: solid 1px")
        title = DivWdg()
        title.add_class("maq_search_bar")
        #x = DivWdg("[x]")
        #x.add_style("float: right")
        #title.add(x)
        title.add("Tasks")
        td.add(title)
        task_wdg = SObjectTaskTableElement()
        task_wdg.set_sobject(sobject)
        td.add(task_wdg)
        td.add_style('cell-padding','10')


        # discussion
        td = table.add_cell()
        #td.add_style("min-width: 300px")
        #td.add_style("width: 600px")
        td.add_style("vertical-align: top")
        td.add_style("padding-left: 5px")
        td.add_style("border-right: solid 1px")
       
        title = DivWdg()
        title.add_class("maq_search_bar")
        #x = DivWdg("[x]")
        #x.add_style("float: right")
        #title.add(x)
        title.add("Notes")
        td.add(title)
        discussion_wdg = DiscussionWdg()
        discussion_wdg.preprocess()
        discussion_wdg.set_sobject(sobject)
        td.add(discussion_wdg)
        note_panel = discussion_wdg.get_note_menu()
        td.add(note_panel)

        div.add(table)
       

        div.add(HtmlElement.hr())
        div.add(HtmlElement.br(clear="all"))

        title_wdg = DivWdg()
        title_wdg.add_class("maq_search_bar")
        #x = DivWdg("[x]")
        #x.add_style("float: right")
        #title_wdg.add(x)
        #title_wdg.add_style("font-size: 1.5em")
        title_wdg.add("Detail" )
        div.add(title_wdg)
        div.add(HtmlElement.br())



        # TEST getting schema
        search_type = sobject.get_base_search_type()
        schema = Schema.get_by_sobject(sobject)
        child_types = schema.get_child_types(search_type)




        # add a second table
        table = Table()
        table.set_max_width()


        # show the snapshots for this sobject
        search_type = "sthpw/snapshot"
        search = Search(search_type)
        search.add_sobject_filter(sobject)
        search.set_limit(25)
        sobjects = search.get_sobjects()


        table.add_row()
        nav_td = table.add_cell()
        nav_td.add_style("width: 100px")
        nav_td.add_style("vertical-align: top")
        section_wdg = my.get_section_wdg(sobject)
        nav_td.add( section_wdg )

        parent_key = SearchKey.get_by_sobject(sobject)
        content_wdg = ViewPanelWdg(search_type=search_type, element_name='Snapshots', \
            title='Snapshots', view='table', parent_key=parent_key, do_search=True)
        #content_wdg.set_sobjects(sobjects)
        content_td = table.add_cell()
        content_td.set_id("sobject_relation")
        content_td.add_style("display: table-cell")
        content_td.add_style("vertical-align: top")
        content_td.add_style("padding-left: 10px")
        content_td.add(content_wdg)

        div.add(table)

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

示例12: get_display

    def get_display(my):
        from pyasm.biz import Project

        security = Environment.get_security()
        if not security.check_access("builtin", "side_bar_schema", "allow", default="deny"):
            return DivWdg()


        section_div = LabeledHidableWdg(label="Schema Views")
        section_div.set_attr('spt_class_name', Common.get_full_class_name(my) )

        palette = Palette.get()
        color = palette.color("background3")

        project_div = RoundedCornerDivWdg(hex_color_code=color,corner_size="10")
        project_div.set_dimensions( width_str='175px', content_height_str='100px' )

        project = Project.get()
        project_code = project.get_code()
        project_type = project.get_type()

        div = DivWdg()
        section_div.add(project_div)
        project_div.add(div)

        # get project type schema
        schema = Schema.get_by_code(project_code)
        if schema:
            div.add( my.get_schema_wdg(schema) )
        #if not project_type:
        #    raise SetupException("Project type not found for this [%s]" %project_code)
        if project_type:
            schema = Schema.get_predefined_schema(project_type)
            if schema:
                div.add( my.get_schema_wdg(schema) )

        schema = Schema.get_predefined_schema('config')
        div.add( my.get_schema_wdg(schema) )

        schema = Schema.get_admin_schema()
        div.add( my.get_schema_wdg(schema) )

        return section_div


        # create a fake schema
        project = Project.get()
        db_name = project.get_database()
        sql = DbContainer.get(db_name)
        tables = sql.get_tables()
        tables.sort()
        tables_str = "\n".join( ['<search_type name="%s"/>'%x for x in tables] )

        # look at all of the search objects for mapped tables
        search = Search("sthpw/search_object")
        #search.add_where('''"namespace" = 'MMS' or namespace = '{project}' ''')
        search.add_filter("namespace", 'MMS')
        search.add_filter("namespace", '{project}')
        search.add_where("or")
        search_types = search.get_sobjects()
        #for search_type in search_types:
        #    print "hhhh: ", search_type

        schema_xml = '''
        <schema>
        %s
        </schema>
        ''' % tables_str
        schema = SearchType.create("sthpw/schema")
        schema.set_value("code", "table")
        schema.set_value("schema", schema_xml)
        #div.add( my.get_schema_wdg(schema) )



        return section_div
开发者ID:blezek,项目名称:TACTIC,代码行数:76,代码来源:schema_section_wdg.py

示例13: _get_predefined_url

    def _get_predefined_url(cls, key, hash):

        # only allow people with site admin
        security = Environment.get_security()
        is_admin = security.is_admin()
        if not is_admin and key == "admin":
            return None
 
 
        # make some predefined fake urls
        if key in ["link", "tab", "admin"]:
            # this is called by PageNav
            if key == "admin":
                expression = "/admin/link/{link}"
            else:
                expression = "/%s/{link}" % key
            options = Common.extract_dict(hash, expression)
            link = options.get("link")
            
            if not link:
                return None


            from tactic.ui.panel import SideBarBookmarkMenuWdg
            personal = False
            if '.' in link:

                # put in a check to ensure this is a user
                parts = link.split(".")

                user = Environment.get_user_name()
                
                def is_personal(user, parts):
                    '''See if parts contains period
                       seperated form of username.'''
                    acc = ""
                    for part in parts:
                        if acc == "":
                            acc = part
                        else:
                            acc = "%s.%s" % (acc, part)
                        if user == acc:
                            return True
                    return False

                personal = is_personal(user, parts) 
                
            # test link security
            project_code = Project.get_project_code()
            security = Environment.get_security()
            keys = [
                    { "element": link },
                    { "element": "*" },
                    { "element": link, "project": project_code },
                    { "element": "*", "project": project_code }
            ]
            if not personal and not security.check_access("link", keys, "allow", default="deny"):
                print "Not allowed"
                return None


            # This is used to find a sub menu (?)
            #view = link
            view = "definition"
            config = SideBarBookmarkMenuWdg.get_config("SideBarWdg", view, personal=personal)

            view = config.get_element_attribute(link, 'view')
            if view:
                options['widget_key'] = 'custom_layout'
                options['view'] = view
                class_name = None
            else:
                options = config.get_display_options(link)
                class_name = config.get_display_handler(link)


            if not options:

                from pyasm.biz import Schema
                config_xml = []
                config_xml.append( '''
                <config>
                ''')
         
                config_schema = Schema.get_predefined_schema('config')
                SideBarBookmarkMenuWdg.get_schema_snippet("_config_schema", config_schema, config_xml)
                schema = Schema.get_admin_schema()
                SideBarBookmarkMenuWdg.get_schema_snippet("_admin_schema", schema, config_xml)

                config_xml.append( '''
                </config>
                ''')

                xml = "".join(config_xml)

                from pyasm.widget import WidgetConfig
                schema_config = WidgetConfig.get(view="_admin_schema", xml=xml)
                options = schema_config.get_display_options(link)
                if not options:
                    schema_config.set_view("_config_schema")
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:101,代码来源:hash_panel_wdg.py

示例14: get_display

    def get_display(my):
        top = my.top
        my.set_as_panel(top)
        top.add_class("spt_delete_top")
        top.add_color("background", "background")
        top.add_color("color", "color")
        top.add_border()
        top.add_style("width: 300px")
        top.add_border()


        search_key = my.kwargs.get("search_key")
        search_keys = my.kwargs.get("search_keys")
        if search_key:
            sobject = Search.get_by_search_key(search_key)
            sobjects = [sobject]
            search_keys = [search_key]
        elif search_keys:
            sobjects = Search.get_by_search_keys(search_keys)
            sobject = sobjects[0]

        if not sobjects:
            msg =  "%s not found" %search_key
            return msg
        search_type = sobject.get_base_search_type()

        if search_type in ['sthpw/project', 'sthpw/search_object']:
            msg = 'You cannot delete these items with this tool'
            return msg


        my.search_keys = search_keys


        title = DivWdg()
        top.add(title)
        title.add_color("background", "background", -10)
        if my.search_keys:
            title.add("Delete %s Items" % len(my.search_keys))
        else:
            title.add("Delete Item [%s]" % (sobject.get_code()))
        title.add_style("font-size: 14px")
        title.add_style("font-weight: bold")
        title.add_style("padding: 10px")

        content = DivWdg()
        top.add(content)
        content.add_style("padding: 10px")


        content.add("The item to be deleted has a number of dependencies as described below:<br/>", 'heading')

        # find all the relationships
        schema = Schema.get()
        related_types = schema.get_related_search_types(search_type, direction="children")
        parent_type = schema.get_parent_type(search_type)
        child_types = schema.get_child_types(search_type)


        # some special considerations
        # FIXME: this needs to be more automatic.  Should only be
        # deletable children (however, that will be defined)
        if search_type in ['sthpw/task','sthpw/note', 'sthpw/snapshot']:
            if "sthpw/project" in related_types:
                related_types.remove("sthpw/project")

            if "sthpw/login" in related_types:
                related_types.remove("sthpw/login")

            if "config/process" in related_types:
                related_types.remove("config/process")



        if parent_type in related_types:
            related_types.remove(parent_type)

        related_types.append('sthpw/note')
        related_types.append('sthpw/task')
        related_types.append('sthpw/snapshot')
        if 'sthpw/work_hour' not in related_types:
            related_types.append('sthpw/work_hour')
       
        items_div = DivWdg()
        content.add( items_div )
        items_div.add_style("padding: 10px")
        valid_related_ctr = 0
        for related_type in related_types:
            if related_type == "*":
                print "WARNING: related_type is *"
                continue
            if related_type == search_type:
                continue
            if related_type in ['sthpw/search_object','sthpw/search_type']:
                continue

            item_div = my.get_item_div(sobjects, related_type)
            if item_div:
                items_div.add(item_div)
                valid_related_ctr += 1
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:101,代码来源:delete_wdg.py

示例15: get_by_sobjects

    def get_by_sobjects(sobjects, process=None, order=True):

        if not sobjects:
            return []


        # quickly go through the sobjects to determine if their search types
        # are the same
        multi_stypes = False
        for sobject in sobjects:
            if sobject.get_search_type() != sobjects[0].get_search_type():
                multi_stypes = True
                break

        
        search = Search( Task.SEARCH_TYPE )
        if multi_stypes:
            # sort this into a dictionary and make multiple calls to 
            # search.add_relationship_filters
            # use the first sobject as a sample
            sobjects_dict = {}
            for sobject in sobjects:
                st = sobject.get_search_type()
                sobj_list = sobjects_dict.get(st)
                if sobj_list == None:
                    sobjects_dict[st] = [sobject]
                else:
                    sobj_list.append(sobject)

        
            search.add_op('begin')
            for key, sobj_list in sobjects_dict.items():
                search.add_op('begin')
                search.add_relationship_filters(sobj_list)
                search.add_op('and')
            search.add_op('or')



        else:

            from pyasm.biz import Schema
            schema = Schema.get()

            # FIXME: why doesn't the ops work here?
            filters = []
            search.add_relationship_filters(sobjects)
            """
            for sobject in sobjects:
                search_type = sobject.get_search_type()
                attrs = schema.get_relationship_attrs("sthpw/task", search_type)
                attrs = schema.resolve_relationship_attrs(attrs, "sthpw/task", search_type)
                search_code = sobject.get_value(attrs.get("to_col"))
                #search_code = sobject.get_value("code")
                #search.add_filter('search_type', search_type)
                #search.add_filter('search_id', search_id, quoted=False)
                #search.add_op("and")
                if attrs.get("from_col") == "search_code":
                    filters.append("search_type = '%s' and search_code = '%s'" % (search_type, search_code))
                else:
                    filters.append("search_type = '%s' and search_id = %s" % (search_type, search_code))
            search.add_where(" or ".join(filters))
            """

        search.add_order_by("search_type")

        search.add_order_by("search_code")
        search.add_order_by("search_id")



        # get the pipeline of the sobject
        pipeline = Pipeline.get_by_sobject(sobject)
        if order:
            if pipeline:
                process_names = pipeline.get_process_names(True)
                search.add_enum_order_by("process", process_names)
            else:
                search.add_order_by("process")

            search.add_order_by("id")

        if process:
           
            if isinstance(process, basestring):
                search.add_filter("process", process)
            else:
                search.add_filters("process", process)

        tasks = search.get_sobjects()
        return tasks
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:91,代码来源:task.py


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