def get(self): a = AnalysesHandler() analyses_gdata = AnalysisGData.gql( "ORDER BY created_at DESC LIMIT 0,1") template_values = { 'gdata': analyses_gdata[0].gdatas, 'BristolSentiment': "%.2f" % a.getAnalysisForPlace('Bristol'), 'OxfordSentiment': "%.2f" % a.getAnalysisForPlace('Oxford'), 'LondonSentiment': "%.2f" % a.getAnalysisForPlace('London'), 'YorkSentiment': "%.2f" % a.getAnalysisForPlace('York'), 'MargateSentiment': "%.2f" % a.getAnalysisForPlace('Margate'), 'BristolImg': a.getImageForScore(a.getAnalysisForPlace('Bristol')), 'OxfordImg': a.getImageForScore(a.getAnalysisForPlace('Oxford')), 'LondonImg': a.getImageForScore(a.getAnalysisForPlace('London')), 'YorkImg': a.getImageForScore(a.getAnalysisForPlace('York')), 'MargateImg': a.getImageForScore(a.getAnalysisForPlace('Margate')), 'sitename': "Twitty City" } loader = FileSystemLoader(os.path.dirname(__file__) + '/../templates/') env = Environment(loader=loader) template = env.get_template('index.html') self.response.out.write(template.render(template_values))
def get(self): datatype = self.request.get('datatype') fortnight_ago = datetime.now() + timedelta(days=-14) counter = 0 self.response.out.write( "Looking to delete stuff from before " + str(fortnight_ago) + "<br>" ) if datatype == "tweet": old_tweets = Tweet.gql( 'WHERE created_at < :before LIMIT 1000', before=fortnight_ago) for t in old_tweets: t.delete() counter += 1 elif datatype == "analysis": old_analyses = Analysis.gql( 'WHERE created_at < :before LIMIT 1000', before=fortnight_ago) for a in old_analyses: a.delete() counter += 1 elif datatype == "gdata": old_gdatas = AnalysisGData.gql( 'WHERE created_at < :before LIMIT 50', before=fortnight_ago) for g in old_gdatas: g.delete() counter += 1 else: self.response.out.write("Please say what datatype you'd like to tidy up. ") self.response.out.write(str(counter) + " items deleted")
def get(self): a = AnalysesHandler() analyses_gdata = AnalysisGData.gql("ORDER BY created_at DESC LIMIT 0,1") template_values = { 'gdata': analyses_gdata[0].gdatas, 'BristolSentiment': "%.2f" % a.getAnalysisForPlace('Bristol'), 'OxfordSentiment': "%.2f" % a.getAnalysisForPlace('Oxford'), 'LondonSentiment': "%.2f" % a.getAnalysisForPlace('London'), 'YorkSentiment': "%.2f" % a.getAnalysisForPlace('York'), 'MargateSentiment': "%.2f" % a.getAnalysisForPlace('Margate'), 'BristolImg': a.getImageForScore(a.getAnalysisForPlace('Bristol')), 'OxfordImg': a.getImageForScore(a.getAnalysisForPlace('Oxford')), 'LondonImg': a.getImageForScore(a.getAnalysisForPlace('London')), 'YorkImg': a.getImageForScore(a.getAnalysisForPlace('York')), 'MargateImg': a.getImageForScore(a.getAnalysisForPlace('Margate')), 'sitename': "Twitty City" } loader = FileSystemLoader(os.path.dirname(__file__) + '/../templates/') env = Environment(loader=loader) template = env.get_template('index.html') self.response.out.write(template.render(template_values))
def get(self): datatype = self.request.get('datatype') fortnight_ago = datetime.now() + timedelta(days=-14) counter = 0 self.response.out.write("Looking to delete stuff from before " + str(fortnight_ago) + "<br>") if datatype == "tweet": old_tweets = Tweet.gql('WHERE created_at < :before LIMIT 1000', before=fortnight_ago) for t in old_tweets: t.delete() counter += 1 elif datatype == "analysis": old_analyses = Analysis.gql( 'WHERE created_at < :before LIMIT 1000', before=fortnight_ago) for a in old_analyses: a.delete() counter += 1 elif datatype == "gdata": old_gdatas = AnalysisGData.gql( 'WHERE created_at < :before LIMIT 50', before=fortnight_ago) for g in old_gdatas: g.delete() counter += 1 else: self.response.out.write( "Please say what datatype you'd like to tidy up. ") self.response.out.write(str(counter) + " items deleted")