Beispiel #1
0
 def venues_linked_to_thing(self, thing):
     query = VenueLinking.all()
     query.filter('thing =', thing)
     linkings = query.fetch(query.count())
     
     venues = [linking.venue.key() for linking in linkings]
     return venues
Beispiel #2
0
 def connectVenueToThing(self, venue, thing):
     """
     crea un legame tra venue e thing
     o incrementa il legame se esiste
     """
     query = VenueLinking.all()
     query.filter('venue =', venue)
     query.filter('thing =', thing)
     linking = query.get()
     
     if linking:
         # cosa gia' connessa
         linking.count += 1
     else:
         # cosa non connessa
         # connetto
         linking = VenueLinking(venue = venue, thing = thing, count = 1)
     
     if linking.count >= VenueLinking.kActiveLinkingMinimumCount:
         linking.is_active = True
         
     linking.put()
     return linking