Exemplo n.º 1
0
    def POST(self):
        user = account.get_current_user()
        google = googlelogin.GoogleLogin()
        next = web.ctx.path
        google_url = google.get_redirect_url(state=next)

        form = RegistrationForm(web.webapi.rawinput())
        if user and form.validate():
            self.add_member(user, form.data)
            return render_template("index.html", form=form, user=user, google_url=google_url, done=True)
        else:
            return render_template("index.html", form=form, user=user, google_url=google_url, simple=self.USE_SIMPLE_FORM)
Exemplo n.º 2
0
 def GET(self):
     if checkLogged():
         postsQuery = web.ctx.orm.query(Post).order_by('modified desc')
         posts = postsQuery.all()
         return render_template('admin.html', posts=posts)
     else:
         raise web.seeother('/login')
Exemplo n.º 3
0
    def GET(self):
        user = account.get_current_user()
        google = googlelogin.GoogleLogin()
        next = web.ctx.path
        google_url = google.get_redirect_url(state=next)

        form = RegistrationForm()
        return render_template("index.html", form=form, user=user, google_url=google_url, simple=self.USE_SIMPLE_FORM)
Exemplo n.º 4
0
 def GET(self):
     postsQuery = web.ctx.orm.query(Post).order_by('modified desc')
     page = web.input(page=1).page-1
     pageSize = web.input(pageSize=10).pageSize
     if page > 1:
         posts = postsQuery.offset(page*pageSize).limit(pageSize).all()
     else:
         posts = postsQuery.limit(pageSize).all()
     return render_template(
         'start.html', posts=posts
     )
Exemplo n.º 5
0
    def GET(self, postId):
        post = web.ctx.orm.query(Post).filter_by(id=postId).first()
        if post:
            f = os.path.join('articles', post.filename)
        else:
            raise web.NotFound

        # mdFile = codecs.open(f, mode='r', encoding='utf8')
        mdFile = open(f, encoding='utf-8')
        content = mdFile.read()
        html = md2html(content)
        mdFile.close()
        # html = md2html('articles/' + post.filename)
        return render_template('view.html', html=html, post=post)
Exemplo n.º 6
0
 def GET(self):
     return render_template('login.html')
Exemplo n.º 7
0
 def GET(self):
     return render_template('about.html')
Exemplo n.º 8
0
    def GET(self, tag):
        posts = web.ctx.orm.query(Tag).filter_by(name=tag).first()

        return render_template(
            'tags.html', posts=posts
        )