def POST(self): if web.ctx.session.login==True: f = form.uploadfile_form() datafile = web.input(datafile={}).datafile msg = '' if not f.validates(): msg = ERR_TABLE_NAME return web.template.render('templates/',base='base',globals={'session':web.ctx.session}).Import(form.uploadfile_form(),msg)#这儿必须返回新的form,不然会出错 else: msg = importdata(models.any2str(f.d.tablename),models.any2str(f.d.filetype),datafile,models.any2str(f.d.sep)) return web.template.render('templates/',base='base',globals={'session':web.ctx.session}).Import(form.uploadfile_form(),msg)#这儿也一样 else: raise web.seeother("/../")
def GET(self): if web.ctx.session.login==True: f = form.uploadfile_form() return web.template.render('templates/',base='base',globals={'session':web.ctx.session}).Import(f) else: raise web.seeother("/../")