Exemple #1
0
 def post(self):
     title = self.get_argument("title", "i have a dream")
     content = self.get_argument("content", "i have a dream")
     tags = self.get_argument("tags", "dream,")
     eMail = email = self.get_secure_cookie('usereMail')
     user = BlogUser.get(BlogUser.email==eMail)
     dream = BlogDream.create(title=title, content=content, user=user)
     model.saveTag(tags, dream.id)
     self.redirect("/dream/id/"+str(dream.id))
Exemple #2
0
 def get_current_user(self):
     email = self.get_secure_cookie('usereMail')
     if not email:
         return None
     else:
         try:
             user = BlogUser.get(BlogUser.email == email)
         except DoesNotExist:
             self.clear_cookie('usereMail')
         return user