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


Python Session.gql方法代码示例

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


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

示例1: filterPlayground

# 需要导入模块: from models import Session [as 别名]
# 或者: from models.Session import gql [as 别名]
    def filterPlayground(self, request):
        """Filter Playground"""
        # create multiple inequality queries
        sessions1 = Session.gql("WHERE typeOfSession != 'NOT_SPECIFIED'")
        sessions2 = Session.gql("WHERE startTime <= TIME('19:00:00')")

        # create new list of items that appear in both lists
        sessions = [sess for sess in sessions1 if sess in sessions2]

        return SessionForms(
            items=[
                self._copySessionToForm(sess)
                for sess in sessions])
开发者ID:gsbullmer,项目名称:conference-central,代码行数:15,代码来源:conference.py

示例2: decorated

# 需要导入模块: from models import Session [as 别名]
# 或者: from models.Session import gql [as 别名]
 def decorated(remark, retort, **kwargs):
     channel=remark['channel']
     user=remark['fromUser']
     session_key='{0}::{1}'.format(channel.key.urlsafe(), user)
     hk=memcache.get(session_key)
     h=None
     if not hk:
         q=Session.gql("WHERE channel = :1 AND user = :2", channel.key, user)
         h=q.get()
     if not h:
         h=Session(channel=channel.key, user=user)
         hk=h.put()
     else:
         hk=h.key
     memcache.set(session_key, hk)
     kwargs['history']=h
     return func(remark, retort, **kwargs)
开发者ID:motord,项目名称:banter,代码行数:19,代码来源:decorators.py

示例3: getSessionsInWishlist

# 需要导入模块: from models import Session [as 别名]
# 或者: from models.Session import gql [as 别名]
    def getSessionsInWishlist(self, request):
        """Get Conference Sessions in Wishlist"""
        try:
            # preload necessary data items
            user = endpoints.get_current_user()
            if not user:
                raise endpoints.UnauthorizedException('Authorization required')
            user_id = getUserId(user)

            prof = self._getProfileFromUser() # get user Profile

            # Get All sessions keys in list
            sess_keys = [ndb.Key(urlsafe=wsck) for wsck in prof.Wishlist]
            
            # filter session by session key
            items = Session.gql("WHERE __key__ IN :1", sess_keys)

            # return results
            return SessionForms(
                items=[self._copySessionToForm(sess) for sess in items]
            )
        except:
            return SessionForms()
开发者ID:vzool,项目名称:fullstack-nanodegree-conference-organization-app,代码行数:25,代码来源:conference.py

示例4: SessionForms

# 需要导入模块: from models import Session [as 别名]
# 或者: from models.Session import gql [as 别名]
            conf = ndb.Key(urlsafe=request.websafeConferenceKey).get()
            if not conf:
                raise endpoints.NotFoundException(
                    'No conference found with key: %s' % request.websafeConferenceKey)
        except Exception, e:
            raise endpoints.NotFoundException(
                'No conference found with key: %s' % request.websafeConferenceKey)

        if not request.sessionType:
            raise endpoints.NotFoundException('SessionType is required')

        # Get All sessions keys in list
        sess_keys = [ndb.Key(urlsafe=wsck) for wsck in conf.sessionKeysScheduleList]
        
        # filter session by typeOfSession
        items = Session.gql("WHERE typeOfSession = :1 AND __key__ IN :2", request.sessionType, sess_keys)

        # return results
        return SessionForms(
            items=[self._copySessionToForm(sess) for sess in items]
        )

    # getSessionsBySpeaker(speaker)
    @endpoints.method(StringMessage, SessionForms,
        path='getSessionsBySpeaker',
        http_method='GET', name='getSessionsBySpeaker')
    def getSessionsBySpeaker(self, request):
        """Get Conference Sessions by Speaker"""
        
        # query for data
        q = Session.query()
开发者ID:vzool,项目名称:fullstack-nanodegree-conference-organization-app,代码行数:33,代码来源:conference.py


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