def get(self, correct=None): message = '' if correct == False: message = 'No I am afraid that is not correct' elif correct == True: message = 'Yes indeed that is correct' # Get a random quote. If the number of quotes gets large, this # might get slow. num_quotes = Quote.all(keys_only=True).count() offset = random.randrange(num_quotes) quote = Quote.all().fetch(1, offset)[0] template_values = { 'message': message, 'quote': quote.text, 'quote_id': quote.key().id() } path = os.path.join(os.path.dirname(__file__), 'index.html') self.response.out.write(template.render(path, template_values))