示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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')
示例#4
0
 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')
示例#5
0
    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)
示例#6
0
    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)