def get(self): newGame = Game() newGame.title = "test1" newGame.gameKey = "dsadfasfdsfaasd" newGame.put() profiles = [None, 'a123456', 'b123456', 'c123456', 'd123456']; myrandom = Random() for i in range(500): points = myrandom.randint(999, 99999) days_before = myrandom.randint(0, 40) tags = [] profile = profiles[myrandom.randint(0, len(profiles) - 1)] name = profile if (name == None): name = "score-{0}".format(i) self.score(newGame, name, tags, points, datetime.datetime.today() - datetime.timedelta(days=days_before), profile) # self.score(newGame, "lastmonth-12341", ["hard"], 10000, datetime.datetime.today() - datetime.timedelta(days=40)) # self.score(newGame, "lastweek-15341", ["hard"], 15000, datetime.datetime.today() - datetime.timedelta(days=8)) # self.score(newGame, "yesterday-17341", [], 5000, datetime.datetime.today() - datetime.timedelta(days=2), "123123145") # self.score(newGame, "yesterday-17341", ["hard"], 7500, datetime.datetime.today() - datetime.timedelta(days=2), "123123145") # self.score(newGame, "yesterday-17341", [], 6500, datetime.datetime.today() - datetime.timedelta(days=1), "123123145") # self.score(newGame, "yesterday-17341", [], 5500, datetime.datetime.today() - datetime.timedelta(days=1), "123123145") # self.score(newGame, "yesterday-17341", [], 4500, datetime.datetime.today() - datetime.timedelta(days=1), "123123145") # self.score(newGame, "yesterday-17341", [], 2500, datetime.datetime.today() - datetime.timedelta(days=1), "123123145") # self.score(newGame, "today-17341", ["hard"], 3500, datetime.datetime.today()) self.response.headers['Content-Type'] = 'text/plain' self.response.out.write("OK")
def post(self): gameKey = cgi.escape(self.request.get('gameKey')).strip() title = cgi.escape(self.request.get('title')).strip() game = Game.all().filter("gameKey =", gameKey).get() error = '' if (game): error = error + "ERROR: gameKey already used\n" if (gameKey == ''): error = error + "ERROR: gameKey cannot be empty\n" if (title == ''): error = error + "ERROR: title cannot be empty\n" if (error != ''): self.response.headers['Content-Type'] = 'text/plain' self.response.out.write(error) return game = Game() game.gameKey = gameKey game.title = title game.put() self.redirect('/')
def get(self): newGame = Game() newGame.title = "test1" newGame.gameKey = "dsadfasfdsfaasd" newGame.put() profiles = [None, 'a123456', 'b123456', 'c123456', 'd123456'] myrandom = Random() for i in range(500): points = myrandom.randint(999, 99999) days_before = myrandom.randint(0, 40) tags = [] profile = profiles[myrandom.randint(0, len(profiles) - 1)] name = profile if (name == None): name = "score-{0}".format(i) self.score( newGame, name, tags, points, datetime.datetime.today() - datetime.timedelta(days=days_before), profile) # self.score(newGame, "lastmonth-12341", ["hard"], 10000, datetime.datetime.today() - datetime.timedelta(days=40)) # self.score(newGame, "lastweek-15341", ["hard"], 15000, datetime.datetime.today() - datetime.timedelta(days=8)) # self.score(newGame, "yesterday-17341", [], 5000, datetime.datetime.today() - datetime.timedelta(days=2), "123123145") # self.score(newGame, "yesterday-17341", ["hard"], 7500, datetime.datetime.today() - datetime.timedelta(days=2), "123123145") # self.score(newGame, "yesterday-17341", [], 6500, datetime.datetime.today() - datetime.timedelta(days=1), "123123145") # self.score(newGame, "yesterday-17341", [], 5500, datetime.datetime.today() - datetime.timedelta(days=1), "123123145") # self.score(newGame, "yesterday-17341", [], 4500, datetime.datetime.today() - datetime.timedelta(days=1), "123123145") # self.score(newGame, "yesterday-17341", [], 2500, datetime.datetime.today() - datetime.timedelta(days=1), "123123145") # self.score(newGame, "today-17341", ["hard"], 3500, datetime.datetime.today()) self.response.headers['Content-Type'] = 'text/plain' self.response.out.write("OK")
def post(self): gameKey = cgi.escape(self.request.get('gameKey')).strip() title = cgi.escape(self.request.get('title')).strip() game = Game.all().filter("gameKey =", gameKey ).get() error = '' if (game): error = error + "ERROR: gameKey already used\n" if (gameKey == ''): error = error + "ERROR: gameKey cannot be empty\n" if (title == ''): error = error + "ERROR: title cannot be empty\n" if (error != ''): self.response.headers['Content-Type'] = 'text/plain' self.response.out.write(error) return game = Game() game.gameKey = gameKey game.title = title game.put() self.redirect('/')