def get(self, url):
        entry = db.GqlQuery(
            "select * from Entry where subject='%s' order by created desc " % url).get()
    
        if entry:
            
            self.render("permalink.html", entry=entry, url=url,
                        username=Account.valid_cookie(self))

        else:
            if Account.valid_cookie(self):
                self.redirect("/_edit" + url)
            else:
                self.redirect("/login")
    def get(self, url):
        entry = db.GqlQuery(
            "select * from Entry where subject='%s' order by created desc" % url).get()

        if Account.valid_cookie(self):

            if entry:
                self.render("edit.html", content=entry.content,
                            username=Account.valid_cookie(self))
            else:
                self.render("edit.html", content="",
                            username=Account.valid_cookie(self))
        else:
            self.redirect("/login")
    def get(self, post_id):

        entry = Entry.get_by_id(int(post_id))

        if entry:
            if Account.valid_cookie(self):

                self.render("edit.html", content=entry.content,
                            username=Account.valid_cookie(self))

            else:
                self.redirect("login")
        else:
            self.write("error: requested Archive does not exist")
    def get(self):
        username = Account.valid_cookie(self)

        if username:
            self.redirect("/")
        else:
            self.write_form()
    def get(self, url):
        entries = db.GqlQuery(
            "select * from Entry where subject='%s' order by created desc" % url)

        previous_entries = list(entries)

        self.render("history.html", username=Account.valid_cookie(
            self), url=url, previous_entries=previous_entries)
    def get(self, post_id):

        entry = Entry.get_by_id(int(post_id))

        if entry:
            self.render("archive.html", username=Account.valid_cookie(
                self), entry=entry, url="/archive/" + post_id, subject=entry.subject)
        else:
            self.write("error")
    def get(self):
        entry = db.GqlQuery(
            "select * from Entry where subject='/' order by created desc").get()

        if entry:
            front_content = entry.content
        else:

            front_content = "<h1>Welcome to the Final!!!</h1>"
            entry = Entry(subject="/", content=front_content)
            entry.put()

        self.render("front.html", username=Account.valid_cookie(
            self), front_content=front_content, url="/")
Exemplo n.º 8
0
    def get(self):

        username = Account.valid_cookie(self)

        entries = top_entries()

        if memcache.get("time"):
            age = int(time.time() - memcache.get("time"))
        else:
            age = None
        #entries=db.GqlQuery("select * from Entry order by created desc limit 50")

        self.render("comments.html", username=username,
                    entries=entries, error="", age=age)
Exemplo n.º 9
0
    def post(self):
        username = Account.valid_cookie(self)
        content = self.request.get("content")

        if content:
            entry = Entry(content=content, username=username)
            entry.put()
            time.sleep(0.1)
            top_entries(True)
            memcache.set("time", time.time())
            self.redirect("/comments")
        else:
            error = "Please enter your comment "
            entries = top_entries()

            self.render("comments.html", username=username,
                        entries=entries, error=error)