def newpost(): form = request.args newpost = Post(title=form['title'], content=urllib.unquote(request.data).decode('utf-8'), num_lookup=0) if form['posttype'] == 'saveonly': newpost.saveonly = True else: newpost.saveonly = False if form.has_key('allowcomment') and form['allowcomment'] == 'on': newpost.allowcomment = True else: newpost.allowcomment = False newpost.post_id = Post.properid() newpost.settags(form['tags']) newpost.create_date = int(time.time()) newpost.update_time = newpost.create_date newpost.put_into() Tag.updatecache() Post.updatecache() #return json.dumps({'message':newpost.content,'post_id':newpost.post_id}) return json.dumps({'message': 'success', 'post_id': newpost.post_id})
def newpost(): form=request.args newpost=Post(title=form['title'], content=urllib.unquote(request.data).decode('utf-8'), num_lookup=0 ) if form['posttype']=='saveonly': newpost.saveonly=True else : newpost.saveonly=False if form.has_key('allowcomment') and form['allowcomment']=='on': newpost.allowcomment=True else : newpost.allowcomment=False newpost.post_id=Post.properid() newpost.settags(form['tags']) newpost.create_date=int(time.time()) newpost.update_time=newpost.create_date newpost.put_into() Tag.updatecache() Post.updatecache() #return json.dumps({'message':newpost.content,'post_id':newpost.post_id}) return json.dumps({'message':'success','post_id':newpost.post_id})