def GET(self, id): form = file_form() file = get_file(id) form.fill(file) req = web.ctx.req req.update({ 'form': form, }) return admin_render.file_edit(**req)
def POST(self, id): form = file_form() if not form.validates(): req = web.ctx.req req.update({ 'form': form, }) return admin_render.file_edit(**req) save_file(int(id), form.d) raise web.seeother('/file/index')
def GET(self): fn = web.input(fn='').fn if not fn: raise web.seeother('/file/index') site_template_dir = web.config.site_template_dir is_file = os.path.isfile(os.path.join(site_template_dir, fn)) lines = None if is_file: # f = open(os.path.join(site_template_dir, fn), 'r') f = File(os.path.join(site_template_dir, fn)) form = file_form() form.fill(f) req = web.ctx.req req.update({ 'form': form, }) return admin_render.file_edit(**req) else: raise web.seeother('/file/index?fpath=' + fn)
def GET(self): fn = web.input(fn='').fn if not fn: raise web.seeother('/file/index') site_template_dir = web.config.site_template_dir is_file = os.path.isfile(os.path.join(site_template_dir, fn)) lines = None if is_file: # f = open(os.path.join(site_template_dir, fn), 'r') f = File(os.path.join(site_template_dir, fn)) form = file_form() form.fill(f) req = web.ctx.req req.update({ 'form': form, }) return admin_render.file_edit(**req) else: raise web.seeother('/file/index?fpath='+fn)