def insert_post(s_id): global new_p_id logging.info("insert_post request user response - Please input your post\n") content = input("Please input your post:") logging.info("Response: ") logging.info(content) logging.info("\n") post.insert(new_p_id,content,s_id,this_u_id) new_p_id += 1 show_posts(s_id)
def response(self): if self.method == 'GET': dir, suf = self.url2dir() content = self.get_state(suf) elif self.method == 'POST': dir, suf = self.url2dir() comment = self.entity.get('comment', None) if comment != None: comment = urllib.parse.unquote(comment) insert(comment, dir, self.url) content = self.get_state(suf) else: content = self.state_404 if content != self.state_404 and os.path.exists(dir): file = open(dir, 'rb') content += file.read() file.close() return content
def insert_post(s_id): global new_p_id content = input("Please input your post:") post.insert(new_p_id, content, s_id, this_u_id) new_p_id += 1 show_posts(s_id)