def subscriptions_query(self):
        import collections

        stub = tc.server_start()

        all_sobjects = tc.query_tab_names(True)

        filters = [('login', env.Env.get_user()), ('project_code', env.Env.get_project())]

        subscriptions = stub.query('sthpw/subscription', filters)

        spl = collections.defaultdict(list)

        for sub in subscriptions:
            split = stub.split_search_key(sub['message_code'])
            spl[split[0]].append(split[1])

        parents = collections.defaultdict(list)
        for key, values in spl.iteritems():
            parents[key.split('?')[0]] = \
                tc.get_sobjects(sobjects_list=stub.query(key, [('code', values)]), get_snapshots=False)

        pprint(all_sobjects)
        pprint(dict(parents))

        # print(stub.get_parent('cgshort/shot?project=the_pirate&code=SHOT00001'))

        server = tc.server_start()
        expr = "@GET(cgshort/shot.cgshort/scenes.code)"
        result = server.eval(expr)
        pprint(result)
        pprint(stub.query('cgshort/shot', [('scenes_code', 'SCENES00001')]))
Ejemplo n.º 2
0
    def subscriptions_query(self):
        import collections

        stub = tc.server_start()

        all_sobjects = tc.query_tab_names(True)

        filters = [('login', env.Env.get_user()),
                   ('project_code', env.Env.get_project())]

        subscriptions = stub.query('sthpw/subscription', filters)

        spl = collections.defaultdict(list)

        for sub in subscriptions:
            split = stub.split_search_key(sub['message_code'])
            spl[split[0]].append(split[1])

        parents = collections.defaultdict(list)
        for key, values in spl.iteritems():
            parents[key.split('?')[0]] = \
                tc.get_sobjects(sobjects_list=stub.query(key, [('code', values)]), get_snapshots=False)

        pprint(all_sobjects)
        pprint(dict(parents))

        # print(stub.get_parent('cgshort/shot?project=the_pirate&code=SHOT00001'))

        server = tc.server_start()
        expr = "@GET(cgshort/shot.cgshort/scenes.code)"
        result = server.eval(expr)
        pprint(result)
        pprint(stub.query('cgshort/shot', [('scenes_code', 'SCENES00001')]))
    def dynamic_query(self, limit=0, offset=0):

        filters = []
        order_bys = ['timestamp desc']
        columns = []
        sobjects_list = tc.server_start().query(self.current_stype, filters, columns, order_bys, limit=limit, offset=offset)
        print self.current_stype
        print sobjects_list
        print filters
        all_process = self.context_items[self.current_stype]
        sobjects = tc.get_sobjects(all_process, sobjects_list)

        return sobjects
Ejemplo n.º 4
0
    def add_child_sobjects(self):
        if not self.info['is_expanded']:

            self.info['is_expanded'] = True

            server = tc.server_start()
            built_process = server.build_search_type(self.child.get('from'), self.project.info.get('code'))

            child_code = None

            relationship = self.child.get('relationship')
            if relationship:
                if relationship == 'search_type':
                    child_code = 'search_code'
                elif relationship == 'code':
                    child_code = '{0}_code'.format(self.child.get('to').split('/')[-1])

            if not child_code:
                child_code = self.child.get('from_col')

            filters = [(child_code, self.sobject.info.get('code'))]

            assets = server.query(built_process, filters)

            if self.stype.pipeline:
                process = []
                for pipe in self.stype.pipeline.values():
                    process.extend(pipe.process.keys())
            else:
                process = []

            sobjects = tc.get_sobjects(process, assets, project_code=self.project.info.get('code'))
            stype = self.stype
            sobject_item_widget = self.get_parent_item_widget()

            for sobject in sobjects.itervalues():
                item_info = {
                    'relates_to': self.info['relates_to'],
                    'is_expanded': False,
                }
                gf.add_sobject_item(
                    self.tree_item,
                    self.parent_ui,
                    sobject,
                    stype,
                    item_info,
                    ignore_dict=sobject_item_widget.ignore_dict
                )
Ejemplo n.º 5
0
    def dynamic_query(self, limit=0, offset=0):

        filters = []
        order_bys = ['timestamp desc']
        columns = []
        sobjects_list = tc.server_start().query(self.current_stype,
                                                filters,
                                                columns,
                                                order_bys,
                                                limit=limit,
                                                offset=offset)
        print self.current_stype
        print sobjects_list
        print filters
        all_process = self.context_items[self.current_stype]
        sobjects = tc.get_sobjects(all_process, sobjects_list)

        return sobjects