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


Python UserData.gql方法代码示例

本文整理汇总了Python中models.UserData.gql方法的典型用法代码示例。如果您正苦于以下问题:Python UserData.gql方法的具体用法?Python UserData.gql怎么用?Python UserData.gql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.UserData的用法示例。


在下文中一共展示了UserData.gql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from models import UserData [as 别名]
# 或者: from models.UserData import gql [as 别名]
    def post(self):
        x = int(self.request.get('x'))
        y = int(self.request.get('y'))
        currentdaytime = datetime.today()

        query = Claim.gql("WHERE x = :1 AND y = :2", x, y)
        Claim_itterator = query.iter(produce_cursors=True)

        for claim in Claim_itterator:
            query2 = UserData.gql("WHERE user = :1", claim.user)
            thisUser = query2.get()
            if thisUser.lastemail < currentdaytime - timedelta(1):
                message = mail.EmailMessage()
                message.sender = ("http://infinitegraffitiwall.appspot.com/ " +
                    "Tile Claim Service <[email protected]>")
                message.to = claim.user.email()
                message.subject = ("A Tile that you have claimed " +
                    "has been changed today.")
                message.body = ("""
A Tile that you have claimed has been changed today.
Tile coordinates """ + str(x) + "," + str(y) + """.
Link to location: http://infinitegraffitiwall.appspot.com/@""" +
                    str(x) + "," + str(y))
                message.send()
                thisUser.lastemail = currentdaytime
                thisUser.put()
开发者ID:Gaurav0,项目名称:InfiniteGraffitiWall,代码行数:28,代码来源:main.py

示例2: get

# 需要导入模块: from models import UserData [as 别名]
# 或者: from models.UserData import gql [as 别名]
 def get(self):
     user = users.get_current_user()
     day_time = datetime.today() - timedelta(1)
     
     query = UserData.gql("WHERE user = :1", user)
     thisUser = query.get()
     if thisUser is None:
         thisUser = UserData(user=user, lastemail=day_time, Number_Tiles=0)
         thisUser.put()
         N_tiles = 0
     else:
         N_tiles = thisUser.Number_Tiles
     self.response.write(N_tiles)
开发者ID:Gaurav0,项目名称:InfiniteGraffitiWall,代码行数:15,代码来源:main.py


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