def find_nearest_city(self): if PlaceBoundary: cached = self.get_cached('nearest_city') if cached: return cached try: result = PlaceBoundary.get_nearest_to(self.location) self.set_cached('nearest_city', result) return result except PlaceBoundary.DoesNotExist: pass return None
def city(self): if PlaceBoundary: cached = self.get_cached('city') if cached: return cached try: result = PlaceBoundary.get_containing(self.location) self.set_cached('city', result) return result except PlaceBoundary.DoesNotExist: pass return None