コード例 #1
0
    for tag in new_json['response']['content']['tags']:
      if tag['id'] == 'tone/minutebyminute':
        rejectLiveblog = True
        break
     
    rejectNoThumb = False
    if 'thumbnail' not in new_json['response']['content']['fields']:
      rejectNoThumb = True
    
    #
    # if we've found any reason to reject it, then do that here
    #
    rejectArticle = False
    if word_count < 1000 or rejectLiveblog == True or rejectNoThumb == True:
      rejectArticle = True
    
    try:
      new_row                  = Items()
      new_row.apiUrl           = str(row['apiUrl'])                    
      new_row.json             = simplejson.dumps(new_json)
      new_row.view_count       = int(row['view_count'])                    
      new_row.percent          = int(row['percent'])                    
      new_row.time_spent       = float(row['time_spent'])
      new_row.word_count       = int(word_count)
      if rejectArticle == True:
        new_row.unreviewed     = 0
        new_row.rejected       = 1
      new_row.put()
    except Exception:
      logging.debug('Fetch Fail: minor: when putting data into database')