Esempio n. 1
0
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)  
Esempio n. 2
0
 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
Esempio n. 3
0
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)