Commits

Mike Orr  committed e9a6ad6

GeoRSS unittest and changelog.

  • Participants
  • Parent commits 272194b

Comments (0)

Files changed (2)

     (Re-added the Atom1 'published' property.)
     (The 'generator' and 'source' properties were lost, but they weren't
     working correctly anyway.)
+    GeoRSS usage: use the Geo\* classes and add  ``geometry=(lat, lon)`` to
+    each news item. Other shapes and a (not yet implemented) Geometry class are
+    allowed; see the source.
+    Note: you should specify the latitude first, but the longitude appears
+    first in the newsfeed.  This is a feature, to comply with the spec.
 * webhelpers.html:
   - New ``HTML.cdata()`` method for producing "<!![CDATA[ ... ]]>" sections.
   - The basic tag builders (``HTML.a()`` and ``HTML.tag("a")``) now have a

File tests/test_feedgenerator.py

     result = feed.writeString("utf-8")
     control = """<?xml version="1.0" encoding="utf-8"?>\n<rss version="2.0"><channel><title>Poynter E-Media Tidbits</title><link>http://www.poynter.org/column.asp?id=31</link><description>A group weblog by the sharpest minds in online media/journalism/publishing.</description><language>en</language><lastBuildDate>Fri, 18 Dec 2009 23:45:12 -0000</lastBuildDate><item><title>Hello</title><link>http://www.holovaty.com/test/</link><description>Testing.</description><pubDate>Fri, 18 Dec 2009 23:45:12 -0000</pubDate></item></channel></rss>"""
     eq_(result, control)
+
+
+def test_geo_point_feed():
+    pubdate = datetime.datetime(2009, 12, 18, 23, 45, 12)
+    feed = fg.GeoAtom1Feed(
+        title=u"Poynter E-Media Tidbits",
+        link=u"http://www.poynter.org/column.asp?id=31",
+        description=u"A group weblog by the sharpest minds in online media/journalism/publishing.",
+        language=u"en",
+    )
+    feed.add_item(
+        title="Hello", 
+        link=u"http://www.holovaty.com/test/",
+        description="Testing.",  
+        pubdate=pubdate,
+        geometry=(-120.5, 50.5))
+    result = feed.writeString("utf-8")
+    f = open("/tmp/feed", "w")
+    f.write(result)
+    f.close()
+    control = """<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xml:lang="en"><title>Poynter E-Media Tidbits</title><link href="http://www.poynter.org/column.asp?id=31" rel="alternate"></link><id>http://www.poynter.org/column.asp?id=31</id><updated>2009-12-18T23:45:12Z</updated><entry><title>Hello</title><link href="http://www.holovaty.com/test/" rel="alternate"></link><updated>2009-12-18T23:45:12Z</updated><published>2009-12-18T23:45:12Z</published><id>tag:www.holovaty.com,2009-12-18:/test/</id><summary type="html">Testing.</summary><georss:point>50.500000 -120.500000</georss:point></entry></feed>"""
+    eq_(result, control)