def _lookup(self): q = self.city if self.city is not None else self.county if q is None or len(q)==0: return if self.state is not None: q += ", " + self.state other = GeoLoc(lookup(q)) if other.city is not None: self._copyfrom(other)
def query(s): ''' Usage >>> g = query('Hindelang') >>> g.city 'Bad Hindelang' >>> g.zipcode '87541' >>> g.state 'Bayern' ''' g = GeoLoc(lookup(s)) return g