예제 #1
0
 def retrievePropertiesWithRating(self, desiredRating):
     return [Property.unmarshal(p) for p in self.properties.select('select * from ' + self.properties.name) if Property._key_from(p) in ratingsCache and ratingsCache[Property._key_from(p)] == desiredRating]
예제 #2
0
def initRatingsCacheIfEmpty(propertiesDomain, ratingsDomain):
    global ratingsCache
    if not ratingsCache:
        sys.stdout.write('Loading ratings cache, you should see this message in the logs only once per run... ')
        sys.stdout.flush()
        ratingsCache = dict([(propKey, ratingsDomain.get_item(propKey)['rating']) for propKey in [Property._key_from(prop) for prop in propertiesDomain.select('select * from ' + propertiesDomain.name)] if ratingsDomain.get_item(propKey)])
        sys.stdout.write('done\n')
        sys.stdout.flush()
예제 #3
0
 def retrieveNewProperties(self):
     return [Property.unmarshal(p) for p in self.properties.select('select * from ' + self.properties.name) if Property._key_from(p) not in ratingsCache]