本文整理汇总了Python中models.Game.update方法的典型用法代码示例。如果您正苦于以下问题:Python Game.update方法的具体用法?Python Game.update怎么用?Python Game.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Game
的用法示例。
在下文中一共展示了Game.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import update [as 别名]
def get(self):
errors = []
user = users.get_current_user()
if not user:
logging.error('Post when not logged in!')
self.abort(500)
email = user.email()
try:
country_code = self.request.headers["X-AppEngine-Country"]
except KeyError:
country_code = '?'
logging.info(email)
if not isMedidata(email):
self.redirect('/medidataonly')
return
game = Game()
player = game.selectOneJoin("j.id, j.fullname, m.registered", "`email` = {}", [email])
if player is None:
self.redirect('/needprofilepicture')
elif player[2] == 1:
self.redirect('/')
else:
where = "`jive_profile_id` = {}"
where_inter = [player[0]]
game.update(config.MEDIFACES_PLAYER_TBL, {"registered": 1}, where, where_inter)
# spoofing in users data
base64string = base64.encodestring('{0}:{1}'.format(config.jive_username,config.jive_password))[:-1]
name = player[1]
content = "<body><p>" + name + " just signed up in <a href='https://medifaces-demo-1.appspot.com/' class='jive-link-community-small'>Medifaces</a></p><p></p><p><em>Posted by <a href='https://mdsol.jiveon.com/docs/DOC-14722'>ExpressBot</a></em></p></body>"
data = json.dumps({"visibility": "place", "parent": config.jive_placeUrl + "/"+ str(config.jive_medifaces_space), "type":"update", "content":{ "type":"text/html", "text":content}})
result = urlfetch.fetch(method=urlfetch.POST, url=config.jive_contentUrl, deadline=15, headers={"X-Jive-Run-As": "email " + email, 'Authorization': 'Basic ' + base64string, "Content-Type": "application/json"}, payload=data).content
# spoofing in users data
base64string = base64.encodestring('{0}:{1}'.format(config.jive_username,config.jive_password))[:-1]
# curl -v -u [email protected]:[email protected] -k --header "Content-Type: application/json" -d '{"visibility":"place", "parent":"https://mdsol-sandbox.jiveon.com/api/core/v3/places/41156", "type":"document", "subject":"My place document", "content":{"type":"text/html","text":"<body><p>Test of document in a place</p></body>"} }' "https://mdsol-sandbox.jiveon.com/api/core/v3/contents"
name = player[1]
content = "<body><p>" + name + " just signed up in <a href='https://medex-faces.appspot.com' class='jive-link-community-small'>Medifaces</a></p><p></p><p><em>Posted by <a href='https://mdsol.jiveon.com/docs/DOC-14722'>ExpressBot</a></em></p></body>";
data = json.dumps({"visibility": "place", "parent": config.jive_placeUrl + "/"+ str(config.jive_medifaces_space), "type":"update", "content":{ "type":"text/html", "text":content}});
result = urlfetch.fetch(method=urlfetch.POST, url=config.jive_contentUrl, deadline=15, headers={"X-Jive-Run-As": "email " + email, 'Authorization': 'Basic ' + base64string, "Content-Type": "application/json"}, payload=data).content
#Send a broadcast that we have a new player
broadcast('%s just signed up!' % email)
#Gotta flush the all_players cache
flush_all_players_cache()
self.redirect("/letsplay")