diff --git a/feedgen/ext/geo_entry.py b/feedgen/ext/geo_entry.py index 03e8f41..2fcc409 100644 --- a/feedgen/ext/geo_entry.py +++ b/feedgen/ext/geo_entry.py @@ -294,7 +294,7 @@ class GeoEntryExtension(BaseEntryExtension): if geojson['type'] == 'Point': - coords = '%f %f'.format( + coords = '{:f} {:f}'.format( geojson['coordinates'][1], # latitude is y geojson['coordinates'][0] ) @@ -303,7 +303,7 @@ class GeoEntryExtension(BaseEntryExtension): elif geojson['type'] == 'LineString': coords = ' '.join( - '%f %f'.format(vertex[1], vertex[0]) + '{:f} {:f}'.format(vertex[1], vertex[0]) for vertex in geojson['coordinates'] ) @@ -315,7 +315,7 @@ class GeoEntryExtension(BaseEntryExtension): warnings.warn(GeoRSSPolygonInteriorWarning(geom)) coords = ' '.join( - '%f %f'.format(vertex[1], vertex[0]) + '{:f} {:f}'.format(vertex[1], vertex[0]) for vertex in geojson['coordinates'][0] ) diff --git a/tests/test_extensions/test_geo.py b/tests/test_extensions/test_geo.py index 3855bf4..35dfa84 100644 --- a/tests/test_extensions/test_geo.py +++ b/tests/test_extensions/test_geo.py @@ -26,7 +26,7 @@ class Geom(object): def __str__(self): if self.geom_type == 'Point': - coords = '%f %f'.format( + coords = '{:f} {:f}'.format( self.coords[1], # latitude is y self.coords[0] ) @@ -35,7 +35,7 @@ class Geom(object): elif self.geom_type == 'LineString': coords = ' '.join( - '%f %f'.format(vertex[1], vertex[0]) + '{:f} {:f}'.format(vertex[1], vertex[0]) for vertex in self.coords ) @@ -44,7 +44,7 @@ class Geom(object): elif self.geom_type == 'Polygon': coords = ' '.join( - '%f %f'.format(vertex[1], vertex[0]) + '{:f} {:f}'.format(vertex[1], vertex[0]) for vertex in self.coords[0] ) @@ -54,7 +54,7 @@ class Geom(object): # box not really supported by GeoJSON, but it's a handy cheat here # for testing coords = ' '.join( - '%f %f'.format(vertex[1], vertex[0]) + '{:f} {:f}'.format(vertex[1], vertex[0]) for vertex in self.coords )