Fixed GeoRSS Extemsion

This patch fixes a few issues with pzll request #66 which adds supprt
for a simple GeoRSS extension.
This commit is contained in:
Lars Kiesow 2018-03-04 22:55:37 +01:00
parent 2d9e85d956
commit 27e9cd0c9a
No known key found for this signature in database
GPG key ID: 5DAFE8D9C823CE73
3 changed files with 6 additions and 3 deletions

View file

@ -12,9 +12,10 @@
from feedgen.ext.base import BaseExtension
class GeoExtension(BaseExtension):
'''FeedGenerator extension for Simple GeoRSS.
'''
def extend_ns(self):
return { 'georss' : 'http://www.georss.org/georss' }
return {'georss': 'http://www.georss.org/georss'}

View file

@ -13,6 +13,7 @@
from lxml import etree
from feedgen.ext.base import BaseEntryExtension
class GeoEntryExtension(BaseEntryExtension):
'''FeedEntry extension for Simple GeoRSS.
'''
@ -45,7 +46,7 @@ class GeoEntryExtension(BaseEntryExtension):
'''Get or set the georss:point of the entry.
:param point: The GeoRSS formatted point (i.e. "42.36 -71.05")
:returns: The author of the podcast.
:returns: The current georss:point of the entry.
'''
if point is not None:

View file

@ -136,6 +136,7 @@ class TestExtensionPodcast(unittest.TestCase):
namespaces=ns)
assert author == ['Lars Kiesow']
class TestExtensionGeo(unittest.TestCase):
def setUp(self):
@ -156,7 +157,7 @@ class TestExtensionGeo(unittest.TestCase):
ns = {'georss': 'http://www.georss.org/georss'}
root = etree.fromstring(self.fg.rss_str())
point = root.xpath('/rss/channel/item/georss:point/text()',
namespaces=ns)
namespaces=ns)
assert point == ['42.36 -71.05']