def post(self):
        if not self.user:
            self.redirect('/login')

        subject = self.request.get('subject') [:SUBJECTLEN]
        content = self.request.get('content')

        if subject and content:
            subject = input_to_safe_html(subject)
            content = input_to_extended_safe_html(content)
            p = db_post.Post(parent = db_post.blog_key(), subject = subject, content = content, 
                             author = self.user)
            p.put()
            p.permanent_link = '/community/%s/post/%s' % (str(self.user.name),str(p.key().id()))
            p.put() 
            #The weak part of the code. DB is touching twice here.
            #
            self.redirect(p.permanent_link)
        else:
            error = "subject and content, please!"
            self.render("newpost.html", subject=subject, content=content, error_blog=error,
                        title = "Things indifferrent",)
    def post(self):
        if not self.user:
            self.redirect('/login')

        ctitle = self.request.get('ctitle') [:SUBJECTLEN]
        cdesc = self.request.get('cdesc')
        cprivacy = self.request.get('cprivacy')
        clifearea = self.request.get('clifearea')
        cdiff = self.request.get('cdiff')
        cexptime = self.request.get('cexptime')
        cchosentime = self.request.get('cchosentime')
       
        if ctitle and (cexptime or cchosentime):
            if cexptime:
                exptime = int(cexptime)
            else:
                exptime = int(cchosentime)
            subject = input_to_safe_html(ctitle)
            cdesc = input_to_extended_safe_html(cdesc)
            cprivacy = bool(int(cprivacy))
            c = db_course.Task(parent = db_course.task_key(), title = ctitle, description = cdesc, 
                             author = self.user, privacy = cprivacy, 
                             lifearea = clifearea, difficulty = int(cdiff),
                             expected_time = exptime, real_time = exptime,
                             condition = 10)

            c.put()
           
            self.redirect("/ftu/%s/tasks?condition=10"%(self.user.name) )

        else:
            self.render("newtask.html", title = "Things indifferrent",lifearea = ftu_struct.LifeArea,
                         error = "Fill all fields, please.", 
                         ctitle = ctitle,
                         cdesc = cdesc,
                         )