Пример #1
0
def makeVideo(videoID,family_member,video_name):
    video= Video(key_name=videoID, family_member=family_member,likes=0, youtube_id=videoID, parent=family_member)
    video.video_name= video_name 
    video.put()
    safeMemcacheSet(key=videoID,value=video)
    
    
Пример #2
0
def getFamilyMember(name):
    familyMember= memcache.get(name)
    if familyMember is not None:
        return familyMember
    else:
        q= db.Query(FamilyMember)
        q.filter('normalized_name =',name.lower())
        familyMember= q.get()
        safeMemcacheSet(name,familyMember)
        return familyMember
Пример #3
0
 def get_videos(self):
     videos= memcache.get(self.normalized_name+"_videos")
     if videos is not None:
         logging.error("Cache hit")
         return videos
     videos= []
     query= db.Query(Video).ancestor(self)
     for video in query.run():
         videos.append(video)
     safeMemcacheSet(key=self.normalized_name+"_videos",value=videos)
     return videos
Пример #4
0
def createPaige():
    paige= FamilyMember(key_name="paige",first_name="Paige",last_name="Vermeer")
    paige.normalized_name= "paige"
    paige.birth_date= datetime.date(1997,8,5) # August 5, 1997
    paige.high_school= 'Castilleja School'
    paige.high_school_link= "http://www.castillejabasketball.com"
    paige.email= db.Email('*****@*****.**')
    paige.profile_picture= "Paige_Vermeer.png"
    paige.height= "5'7\""
    paige.weight= None
    paige.name_image_string= 'PaigeVermeerName.png'
    paige.GPA= "3.8"
    safeMemcacheSet(key=paige.normalized_name,value=paige)
    paige.put()
Пример #5
0
def createGrant():
    grant= FamilyMember(key_name="grant",first_name="Grant",last_name="Vermeer")
    grant.normalized_name= "grant"
    grant.birth_date= datetime.date(1995,5,8) # May 8, 1995
    grant.high_school= 'Bellarmine College Preparatory'
    grant.email= db.Email('*****@*****.**')
    grant.profile_picture= "Grant_Vermeer.png"
    grant.profile_video= "PJ35W910WQ4"
    grant.height= "6'3\""
    grant.weight= "185"
    grant.high_school_link= "http://www.bcp.org/athletics/team_basketball.aspx"
    grant.name_image_string= 'GrantVermeerName2.png'
    grant.GPA= "4.4"
    grant.twitter_username= "******"
    safeMemcacheSet(key=grant.normalized_name,value=grant)
    createVideosGrant(grant)
    grant.put()
Пример #6
0
 def addLike(self):
     self.likes= self.likes + 1
     self.put()
     safeMemcacheSet(key=self.youtube_id,value=self)
Пример #7
0
 def add_videoID(self,videoID):
     self.video_list.append(videoID)
     self.delete(self.normalized_name+"_videos") #Remove cached video list
     self.put()
     safeMemcacheSet(key=self.normalized_name,value=self)