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 query_tabs(): tab_names = tc.query_tab_names() return tab_names, tc.context_query(tab_names['codes'])