def post(self): visitor.register(self.request) models.newPost({ 'url' :cleanUrl(self.request.get('xtitle')), 'title' :self.request.get('xtitle'), 'content':cleanContent(self.request.get('xcontent')), 'summary':cleanSummary(self.request.get('xcontent')) }) self.redirect("/")
def newpost(): data={ 'title' :'Hello World!', 'url' :'helloworld', 'summary':"""Welcome to my blog!""", 'content':""" <p><b>FABE - Fricking Awesome Blog Engine</b> has been installed!</p> <p>To change the blog settings go to the <a href="/admin">admin console</a>. You will be asked to login to your GAE account, the admin console is restricted and only you have privileged access to it.</p> <p>Please login clicking here: <a href="/admin/options">Admin Console</a></p> <p>You can also click on the avatar to the right to access the admin console.</p> <p>Delete or modify this post at will, you already have <b>FABE</b> installed, enjoy!.</p> """ } models.newPost(data) return data
def POST(self): if session['login'] == 0: raise web.seeother('/') post = web.input() post = models.preprocesspost(post) #post['type'] = int(post['type']) po = models.getPostById(post['title_id'],private=True,edit=True) if po is not None: return render.new(session['user'],post,'Try another Title ID.') #raise web.seeother('%s' % title_id) else: re = models.newPost(post) if re is True: raise web.seeother('edit/%s' % post['title_id']) else: return render.new(session['user'],post,'Error.')