def parseLine(inline): '''String -> ParsedLine''' m = lineregex.match(inline) if m is None or len(m.groups()) != 8: raise ValueError("bad line: " + inline) grps = m.groups() mytime = d.datetime(int(grps[6]), month2num[grps[1]], int(grps[2]), int(grps[3]), int(grps[4]), int(grps[5])) myIsStart = False if grps[7] == 'Experiment started': myIsStart = True pline = ParsedLine(path = grps[0], time = mytime, isStart = myIsStart) return pline
def index(self): users = model.user().getList('*') ##进行表查询 self.assign('users', users) ##设置为模板变量 group = model.groups().getList('*') self.assign('group', group) forum = model.forum().getList('*') self.assign('forum', forum) return self.display('index') ##显示指定模板
def group_info(gid): tableObj = model.groups() ##获取数据表对象 g_info = tableObj.getOne('id,name,description', {'id': gid}) ##进行表查询 tableObj = model.query() ##获取数据表对象 f_list = tableObj.fetchAll( 'select forum.id,forum.title from forum,group_forum gf where gf.gid=%s and gf.fid=forum.id' % gid) ##进行表查询 return g_info, f_list
def gourp_new(pars): tableObj = model.groups() ##获取数据表对象 condition = dict(pars) user_info = web.ctx.session.user_info if user_info: condition['owner'] = user_info['id'] else: return -1 print condition return tableObj.insert(condition)
def group_info(gid): tableObj = model.groups() ##获取数据表对象 g_info = tableObj.getOne('id,name,description', {'id':gid}) ##进行表查询 tableObj = model.query() ##获取数据表对象 f_list = tableObj.fetchAll('select forum.id,forum.title from forum,group_forum gf where gf.gid=%s and gf.fid=forum.id' % gid) ##进行表查询 tableObj = model.group_user() ##获取数据表对象 user_info = web.ctx.session.user_info uid = user_info['id'] u_info = tableObj.getOne('id', {'uid':uid,'gid':gid}) return g_info,f_list,len(u_info)
def group_info(gid): tableObj = model.groups() ##获取数据表对象 g_info = tableObj.getOne('id,name,description', {'id': gid}) ##进行表查询 tableObj = model.query() ##获取数据表对象 f_list = tableObj.fetchAll( 'select forum.id,forum.title from forum,group_forum gf where gf.gid=%s and gf.fid=forum.id' % gid) ##进行表查询 tableObj = model.group_user() ##获取数据表对象 user_info = web.ctx.session.user_info uid = user_info['id'] u_info = tableObj.getOne('id', {'uid': uid, 'gid': gid}) return g_info, f_list, len(u_info)
def list(self): tableObj = model.groups() ##获取数据表对象 listData = tableObj.getList('*') ##进行表查询 self.assign('groups', listData) ##设置为模板变量 return self.display('group_list') ##显示指定模板
def list(self): tableObj = model.groups() ##获取数据表对象 listData = tableObj.getList('*') ##进行表查询 self.assign('groups',listData) ##设置为模板变量 return self.display('group_list') ##显示指定模板
def group_info(gid): tableObj = model.groups() ##获取数据表对象 g_info = tableObj.getOne('id,name,description', {'id':gid}) ##进行表查询 tableObj = model.query() ##获取数据表对象 f_list = tableObj.fetchAll('select forum.id,forum.title from forum,group_forum gf where gf.gid=%s and gf.fid=forum.id' % gid) ##进行表查询 return g_info,f_list