def post(self): import time board_key = self.get_argument("board",None) pic_url = self.get_argument("pic_url",None) thumb_url = self.get_argument("thumb_url",None) content = self.get_argument("content",None) pin = Pin() thumb = Thumb() pic = Pic() board = Board() board.data =board.get(board_key) user_key = self.get_secure_cookie('user_key') _tmp = "%s%s" % (content,user_key) pin_key = pin.genKey(_tmp) if pin_key not in board.data['pins']: board.data['pins'].append(pin_key) board.key = board.data['key'] pin.key = pin_key pin.data['rawtext'] = content pin.data['user'] = user_key pin.data['board'] = board_key pin.data['category'] = board.data['category'] pin.data['createTime'] = int(time.time()) pic.key = pin_key pic.data['url'] = pic_url thumb.key = pin_key thumb.data['url'] = thumb_url try: board.put() pin.post() pic.post() thumb.post() except Exception as what: print what self.write(what) else: self.redirect('/mark/%s/' % pin_key)