def post(self): type = self.get_argument("t", None) if type==None: return try: type = int(type) except: return if type==1: uid = self.get_argument("uid", None) category = self.get_argument("category", None) content = self.get_argument("content", None) if (uid==None) or (category==None) or (content==None): self.write("{\"err\": \"not enough arguments\"}") return try: long(uid) except: return try: int(category) except: return wishlist_data = WishlistData(self.db) id = wishlist_data.insert_new_wish(uid, category, content) self.write("{\"id\": \""+str(id)+"\"}") elif type==2: wish_id = self.get_argument("id", None) if wish_id==None: return wishlist_data = WishlistData(self.db) res = wishlist_data.close_wish(wish_id) if res==None: self.write("{\"err\":\"true\"}") else: self.write("{\"success\":\"true\"}")