X-Git-Url: https://source.tree.se/git?p=treecutter.git;a=blobdiff_plain;f=xinclude%2Faddress.py;h=6a30d7accc13006f17d337ff30ddc6a2c86f8c18;hp=30e8a0713efcfd546e1fc6fa20d5860a7a55b498;hb=2631577aa8cdce4000f4b0240b701e38dca8d202;hpb=b568714b60aa9ba2a7b10c5730c5fa5d4ef29ce1 diff --git a/xinclude/address.py b/xinclude/address.py index 30e8a07..6a30d7a 100755 --- a/xinclude/address.py +++ b/xinclude/address.py @@ -135,7 +135,9 @@ def c(s): return s or '' def s(s,n): - return s or n + if n is not None: + return s or n.text + return s class Address(object): @@ -181,10 +183,11 @@ class Address(object): places = int(root.xpath('count(//place[@place_id])')) if places == 1: place = root.find("place") - self.postcode = s(self.postcode,place.find("boundary").text) - self.city = s(self.city,place.find("city").text) - self.country = s(self.country,place.find("country").text) - self.country_code = s(self.country_code,place.find("country_code").text) +# print etree.tostring(place,encoding='UTF-8',pretty_print=True) + self.postcode = s(self.postcode,place.find("postcode")) + self.city = s(self.city,place.find("city")) + self.country = s(self.country,place.find("country")) + self.country_code = s(self.country_code,place.find("country_code")) self.coord=Coord(place.get("lat"),place.get("lon")) return