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


Python Session.get_session_by_conferencekey方法代码示例

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


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

示例1: _getSessions

# 需要导入模块: from models import Session [as 别名]
# 或者: from models.Session import get_session_by_conferencekey [as 别名]
    def _getSessions(self, webSafeKey):
        """Get all sessions from a conference."""
        confkey = ndb.Key(urlsafe=webSafeKey)
        # check if this key belongs to an actual conference
        if not confkey:
            raise endpoints.NotFoundException('No conference found with this key.')

        # retrieve all sessions from ancestor conferences, using
        # an ndb class method actual query is faster
        return Session.get_session_by_conferencekey(confkey)
开发者ID:gtxll8,项目名称:Project-P4-Conference-Organization-App,代码行数:12,代码来源:conference.py

示例2: _setFeaturedSpeaker

# 需要导入模块: from models import Session [as 别名]
# 或者: from models.Session import get_session_by_conferencekey [as 别名]
    def _setFeaturedSpeaker(speaker, webSafeKey):
        """This will check if the speaker is featured in more
        than one session then it will create an anouncement
        assigning it to memcache.
        """
        # get all existing sessions
        confkey = ndb.Key(urlsafe=webSafeKey)
        all_sessions = Session.get_session_by_conferencekey(confkey)
        # check to see if speaker is present already in other sessions
        speaker_sessions = all_sessions.filter(Session.speaker == speaker)
        if speaker_sessions.count() > 1:
            announcement = '%s %s %s %s' % (
                'This speaker is very popular:',
                speaker,
                '. He is featured in these sessions:',
                ', '.join(sess.name for sess in speaker_sessions))
            memcache.set(FEATURED_SPEAKER_SESSIONS_KEY, announcement)
        else:
            # delete the memcache announcements entry
            announcement = ""
            memcache.delete(FEATURED_SPEAKER_SESSIONS_KEY)

        return announcement
开发者ID:gtxll8,项目名称:Project-P4-Conference-Organization-App,代码行数:25,代码来源:conference.py


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