#!/usr/bin/env python import admin.setup_django_version from google.appengine.ext import db from django.utils import simplejson from admin.models import Items # # Now I want to know what articles are waiting to be reviewed and so on # rows = Items.all() rows.filter('published = ', 1) rows.filter('queued = ', 0) rows.order('-published_ordinal') rows = db.GqlQuery("SELECT * FROM Items WHERE published = 1 AND queued = 0 ORDER BY published_ordinal DESC LIMIT 20") pagesize = 20 offset = 0 counter = 1 winning = [] for row in rows.run(limit=pagesize, offset=offset): JSON = simplejson.loads(row.json) result = JSON['response']['content'] winning.append(result) results = {'response': { 'status': 'ok',
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')