Mike Orr avatar Mike Orr committed 86eb17c

Don't swap latitude and longitude in feedgenerator as Django's does.

Comments (0)

Files changed (3)

 
 tip (development version)
 -------------------------
+* webhelpers.feedgenerator:
+  - Don't swap latitude and longitude. The input data and GeoRSS format are
+    both latitude first. Django's feedgenerator swaps the two because GeoDjango
+    has longitude first, but that doesn't apply to WebHelpers.
 * webhelpers.html.grid:
   - New module to create an HTML table from a list of records.
 * webhelpers.html.tags:
     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

tests/test_feedgenerator.py

     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>"""
+<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>-120.500000 50.500000</georss:point></entry></feed>"""
     eq_(result, control)

webhelpers/feedgenerator.py

 # - Note: 'generator' and 'source' properties were lost from a previous
 #   revision of webhelpers.feedgenerator. The implementation had a bug and
 #   can't be used as is.
+# - Don't swap latitude and longitude in ``GeoFeedMixin.georss_coords()``.
+#   Django's feedgenerator does to be compatible with GeoDjango which has
+#   longitude first, but that doesn't apply to WebHelpers.
 
 
 """
         a single white space.  Given a tuple of coordinates, this will return
         a unicode GeoRSS representation.
         """
-        return u' '.join([u'%f %f' % (coord[1], coord[0]) for coord in coords])
+        return u' '.join([u'%f %f' % coord for coord in coords])
 
     def add_georss_point(self, handler, coords, w3c_geo=False):
         """
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.