示例#1
0
  def get(self):
      session = get_current_session()
      html = ""
      if 'user' in session:
          user_id = session['user']
          posts = fbmessages.search_contents_for_tagcloud_page(user_id)
          user = fbqueryuser.queryUserFromDataStore(user_id)
          device = self.determine_device()
          audit.add_audit_record(user.facebook_id, user.displayName,'my_tag_cloud_page', self.request.remote_addr, device)
          post_list = []
          logging.info("Count of words before stop words filter" + str(len(posts)))
          for i in range(0,len(posts)-1):
              if (posts[i] not in stopwords.stop_words()):
                  post_list.append(posts[i])

          c = collections.Counter(post_list)
          html = self.generate_html(c)         
      else:
          logging.info("User id not found in session")      
      self.response.out.write(html)
示例#2
0
  def post(self):
      session = get_current_session()
      friend = self.request.get('friend')
      html = ""
      if self.is_a_friend(friend):
          if 'user' in session:
              user_id = session['user']
              posts = fbmessages.search_contents_for_friend_tagcloud_page(user_id, friend)
              post_list = []
              logging.info("Count of words before stop words filter" + str(len(posts)))
              for i in range(0,len(posts)-1):
                  if (posts[i] not in stopwords.stop_words()):
                      post_list.append(posts[i])

              c = collections.Counter(post_list)
              html = self.generate_html(c)         
          else:
              logging.info("User id not found in session")  
      else:
          html="<span style=\"color:#0000A0;font-size:25px\" >Unauthorized friend request</span>"  
  
      self.response.out.write(html)