def task(task_id): if not isLogin(): return None url = r'http://%s/InterfaceSys/taskRead/' % penv.host() parm = {} parm['t_id'] = task_id return post(url, parm, penv.cookie())
def publishAsset(asset_id, qc, files = None, to_dir = None): if not isLogin(): return None url = r'http://%s/InterfaceSys/publishTask/' % penv.host() parm = {} parm['task_id'] = asset_id parm['qc'] = qc if files and to_dir: parm['is_copy'] = False parm['src'] = files parm['dst'] = to_dir.encode('UTF-8') else: parm['is_copy'] = True return post(url, parm, penv.cookie())
def asset(task_id = None, asset_id = None): if not isLogin(): return None url = r'http://%s/InterfaceSys/assetRead/' % penv.host() parm = {} if task_id: parm['t_id'] = task_id if asset_id: parm['a_id'] = asset_id a_json_stream = post(url, parm, penv.cookie()) if not a_json_stream: return None a_data = json.loads(a_json_stream) a = passet.dict_to_asset(a_data) return a
def getChild(asset_id): if not isLogin(): return [] url = r'http://%s/InterfaceSys/allRead/%s' % (penv.host(), asset_id) parm = {} parm['id'] = asset_id json_stream = post(url, parm, penv.cookie()) if not json_stream: return [] anythings = [] a_data = json.loads(json_stream) for a_dict in a_data: a = passet.dict_to_asset(a_dict) if a: anythings.append(a) return anythings
def projects(): if not isLogin(): return [] url = r'http://%s/InterfaceSys/allRead/' % penv.host() parm = {} parm['id'] = 'p_id' proj_json_stream = post(url, parm, penv.cookie()) if not proj_json_stream: return [] projs = [] projects_data = json.loads(proj_json_stream) for proj_dict in projects_data: proj = passet.Project(proj_dict['name']) proj.setAttributes(proj_dict) projs.append(proj) return projs
def myTasks(project_id = None): if not isLogin(): return [] url = r'http://%s/InterfaceSys/taskRead/' % penv.host() parm = {} parm['username'] = penv.user() if project_id: parm['p_id'] = project_id ts_json_stream = post(url, parm, penv.cookie()) if not ts_json_stream: return [] ts = [] ts_data = json.loads(ts_json_stream) for t_dict in ts_data: t = passet.dict_to_asset(t_dict) if t: ts.append(t) return ts
def isLogin(): if penv.cookie() and penv.host(): return True else: return False