当前位置: 首页>>代码示例>>Python>>正文


Python Game.update方法代码示例

本文整理汇总了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")   
开发者ID:mdsol,项目名称:jive,代码行数:55,代码来源:views.py


注:本文中的models.Game.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。