Пример #1
0
 def getFeaturedSpeaker(self, request):
     """Return Speaker from memcache."""
     #if empty memcache
     if memcache.get(MEMCACHE_FEATURED_SPEAKER_KEY) == None:
         return FeaturedSpeakerForm(featuredSpeaker="",
                                    sessions=[],
                                    conference="")
     #populate FeaturedSpeakerForm if memcache is not empty
     return FeaturedSpeakerForm(
         featuredSpeaker=\
         memcache.get(MEMCACHE_FEATURED_SPEAKER_KEY)['featured_speaker'] \
         or "",
         sessions=memcache.get(MEMCACHE_FEATURED_SPEAKER_KEY)['sessions']\
         or [],
         conference=\
         memcache.get(MEMCACHE_FEATURED_SPEAKER_KEY)['conference']) or ""
Пример #2
0
    def getFeaturedSpeaker(self, request):
        """Takes the websafeKey of a conference and returns a featured
        speaker form object."""
        featured_speaker = memcache.get(request.websafeConferenceKey)

        if not featured_speaker:
            raise endpoints.NotFoundException("""No featured speaker found in
            memcache for the given conference.""")
        return FeaturedSpeakerForm(
            speaker=featured_speaker['speaker'],
            websafeSessionKeys=featured_speaker['websafeSessionKeys'])