Ejemplo n.º 1
0
 def get(self, path):
     page = model.get_page(path)
     if page:
         page_content = stuff.escape_html(page.content)
         self.render('wikipage.html', page_content=page_content)
     else:
         self.redirect('/_edit%s' % path)
Ejemplo n.º 2
0
 def get(self, path):
     page = model.get_page(path)
     if page:
         page_content = stuff.escape_html(page.content)
         self.render('wikipage.html', page_content = page_content)
     else:
         self.redirect('/_edit%s' % path)
Ejemplo n.º 3
0
 def get(self, path):
     if self.user:
         page = model.get_page(path)
         content = page.content if page else ' '
         self.render('edit.html', content=content)
     else:
         self.write('Not logged in')
Ejemplo n.º 4
0
 def get(self, path):
     if self.user:
         page = model.get_page(path)
         content = page.content if page else ' '
         self.render('edit.html', content = content)
     else:
         self.write('Not logged in')
Ejemplo n.º 5
0
 def GET(self):
     userid = web.ctx.session.get('userid',-1)
     username = get_username(userid=userid)
     superuser = is_superuser(userid=userid)
     index_wiki = get_page()
     ctx = Storage(locals())
     return render.index(ctx)
Ejemplo n.º 6
0
 def GET(self, n):
     """ get issue json  """
     n = int(n)
     web.header('Content-Type', 'application/json')
     dout = {};
     dout["success"] = True
     dout["message"] = list(model.get_page(n))
     return json.dumps(dout,sort_keys=True,indent=2,default=json_serial)
Ejemplo n.º 7
0
 def GET(self):
     userid = web.ctx.session.get('userid',-1)
     superuser = is_superuser(userid=userid)
     if not is_superuser(userid):
         raise web.seeother("/index", absolute=True)
     username = get_username(userid=userid)
     index_wiki = get_page()
     ctx = Storage(locals())
     return render.edit_index(ctx) 
Ejemplo n.º 8
0
 def GET(self, page=None):
     f = self.page_form()
     pg = model.get_page(page)
     if pg:
         f.name.set_value(pg.name)
         f.title.set_value(pg.title)
         f.position.set_value(pg.position)
         f.pagesize.set_value(pg.pagesize)
         f.draft.set_value(pg.draft)
     return render.page(f)
Ejemplo n.º 9
0
 def GET(self, name, pg=0):
     page = model.get_page(name)
     pages = model.get_pages()
     ga = model.get_site().ga
     if bool(page):
         content = self.__getContent(page, pg)
         pgs = plain.pages(dict(page), pages)
         return render.page(ga, dict(page), content, pgs)
     else:
         raise web.seeother('/home')
Ejemplo n.º 10
0
 def POST(self, page=None):
     data = self.page_form()
     if data.validates():
         d = data.d
         cur = model.get_page(page)
         print d
         if cur:
             model.update_page(page, d.title, d.position, d.pagesize, int(d.draft))
         else:
             model.add_page(d.name, d.title, int(d.position), int(d.pagesize), int(d.draft))
     raise web.seeother('/page')
Ejemplo n.º 11
0
def get_post(post_id):
    ## Get blog post contents
    post_data = model.get_page(post_id)
    
    ## If post doesn't exist, call 404
    if post_data == None:
        abort(404)

    ##
    title, html = post_data

    ## Returned rendered template
    return render_template('page.html', title=title, html=html)
Ejemplo n.º 12
0
 def post(self, path):
     if self.user:
         page = model.get_page(path)
         content = self.request.get('content')
         if not page:
             author = self.user.name
             model.new_page(author = author, path = path, content = content)
         else:
             editor = self.user.name
             model.edit_page(path = path, editor = editor, content = content)
         self.redirect('%s' % path)
     else:
         self.write('Not Logged in')
Ejemplo n.º 13
0
 def post(self, path):
     if self.user:
         page = model.get_page(path)
         content = self.request.get('content')
         if not page:
             author = self.user.name
             model.new_page(author=author, path=path, content=content)
         else:
             editor = self.user.name
             model.edit_page(path=path, editor=editor, content=content)
         self.redirect('%s' % path)
     else:
         self.write('Not Logged in')
Ejemplo n.º 14
0
 def GET(self, p='10'):
     p = int(p)
     j.article = model.get_all_article(p, cid=90)
     j.page = model.get_page(p, pages='page')
     return render('page',
                   title=webname,
                   gonggao_h=Gonggao_S,
                   footer=dibu,
                   info=fubiaoti,
                   homelink=weblink,
                   game=dwgame,
                   shuma=dwshuma,
                   weifeng=weifengs,
                   **j)
Ejemplo n.º 15
0
 def GET(self, p='10'):
     p = int(p)
     j.article = model.get_all_article(p, cid=90)
     j.page = model.get_page(p, pages='page')
     return render('page',
                   title=webname,
                   gonggao_h=Gonggao_S,
                   footer=dibu,
                   info=fubiaoti,
                   homelink=weblink,
                   game=dwgame,
                   shuma=dwshuma,
                   weifeng=weifengs,
                   **j)
Ejemplo n.º 16
0
    def GET(self, page=1):
        page = int(page)
        per_page = 10 
        offset = (page - 1) * per_page

        post_contents = model.get_page(per_page, offset) 
        content_count = model.get_content_count() 

        count_of_pages = content_count.count / per_page + 1

        if page > count_of_pages:
            raise web.seeother('/')
        else:
            return render.index(post_contents, count_of_pages, curr_page=page)
Ejemplo n.º 17
0
def resume():
    title, html = model.get_page('resume')

    return render_template('page.html', title=title, html=html)
Ejemplo n.º 18
0
def index():
    title, html = model.get_page('index')
    return render_template('page.html', title=title, html=html)