本文整理汇总了Python中models.Game.store方法的典型用法代码示例。如果您正苦于以下问题:Python Game.store方法的具体用法?Python Game.store怎么用?Python Game.store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Game
的用法示例。
在下文中一共展示了Game.store方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_games
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import store [as 别名]
def update_games():
c = db.games_data.find({'createDate' : re.compile("^2012-11-2")})
print "Updating {} games".format(c.count())
for g in c:
if not invalid_games.find_one(g['gameId']):
print "+++ Creating game", g['createDate']
g = Game.store(g)
else:
print "invalid game"
示例2: update_users
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import store [as 别名]
def update_users():
users = [
'neoel'#, 'inflammae', 'empathia', 'xenotos', 'volcanow7', 'dingesenator', 'de kleine wolf', 'themvanh', 'metamess', 'rastaroos', 'eelse', 'sneeuwwit'
]
#users = User.find().sort('games_updated')
#users = User.find()
users = User.find({'simple_name' : {'$in' : users}})
n_users_done = 1
for user in users:
print u"+++ Updating user({}): {}".format(n_users_done, user.name)
user.update_games()
n_users_done += 1
# for each user fetch each game, and update that
gamedata = db.games_data.find(dict(userId = user._id))
for g in gamedata:
if not invalid_games.find_one(g['gameId']):
g = Game.store(g)
else:
print "invalid game"