Esempio n. 1
0
 def getAreasOfCountry(self, country):
     #Coupling of method interface with NDB-based model... remove.
     if not country.key.kind() == "Country":
         raise ValueError("key must refer to an instance of Country.")
     query = Area.query(ancestor=country.key).order(Area.name)
     areas = query.fetch()
     return areas
Esempio n. 2
0
 def onGet(self, countryNameKey):
     self._country = Country.get_by_id(self.helper.getNormalisedCountryName(countryNameKey))
     if self._country is None:
         return
     self._areas = [y for y in Area.query(ancestor=self._country.key).fetch()]
Esempio n. 3
0
 def getAreasOfCountryForId(self, countryId):
     query = Area.query(ancestor=ndb.Key("Country", countryId)).order(Area.name)
     areas = query.fetch()
     return areas