示例#1
0
文件: main.py 项目: awans/mis
 def get(self):
   query_string = self.request.get('q')
   misses = None
   if query_string:
     post_ids = missearch.missearch(query_string)
     misses = Mis.get_by_key_name(post_ids)
   self.response.out.write(template.render('templates/search.html',{'misses':misses, 'query_string':query_string }))
示例#2
0
文件: main.py 项目: awans/mis
 def get(self):
   count = 0
   for m_h in MisHTML.all().filter('parsed_version <', PARSER_VERSION):
     post_dict = helper.parse_post(m_h.html, m_h.key().name())
     m = Mis(key_name = post_dict['id'],
             html = m_h.html, 
             post_id = post_dict['id'],
             url = post_dict['url'],
             title = post_dict['title'],
             body = post_dict['body'],
             location = post_dict['location'],
             age = post_dict['age'],
             me_gender = post_dict['me_gender'],
             you_gender = post_dict['you_gender'],
             posted = m_h.posted)
     m.put()
     m_h.parsed_version = PARSER_VERSION
     m_h.put()
     count += 1
     
   self.response.out.write('Parsed ' + str(count))
示例#3
0
文件: main.py 项目: awans/mis
 def summarize_field(field):
   missed_connections = [db.to_dict(m) for m in Mis.all()]
   values = [p[field] for p in missed_connections]
   valuecounts = dict((i,values.count(i)) for i in set(values) if i)
   return sorted(valuecounts.iteritems(), key=operator.itemgetter(1), reverse=True)
示例#4
0
文件: main.py 项目: awans/mis
 def get(self):
   misses = Mis.all().order('-posted').fetch(50)
   self.response.out.write(template.render('templates/index.html',{'misses':misses}))