diff options
| author | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-11-24 00:31:44 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-11-24 00:31:44 +0100 | 
| commit | 1b30395108ad1d9dd42e286ca04e534fa928e679 (patch) | |
| tree | 132cf256d8a5f4f340a3157e2ac8327b2d22d420 /chimere/utils.py | |
| parent | 8bcca56ce043e0e4312315d69e436935e28ad9dc (diff) | |
| download | Chimère-1b30395108ad1d9dd42e286ca04e534fa928e679.tar.bz2 Chimère-1b30395108ad1d9dd42e286ca04e534fa928e679.zip | |
Add W3C georss support
Diffstat (limited to 'chimere/utils.py')
| -rw-r--r-- | chimere/utils.py | 17 | 
1 files changed, 11 insertions, 6 deletions
| diff --git a/chimere/utils.py b/chimere/utils.py index 1877441..ed41a04 100644 --- a/chimere/utils.py +++ b/chimere/utils.py @@ -569,17 +569,22 @@ class GeoRSSManager(ImportManager):          if feed['bozo']:              return (0, 0, _(u"RSS feed is not well formed"))          for item in feed['items']: -            if "georss_point" not in item and 'georss_line' not in item: +            if "georss_point" not in item and 'georss_line' not in item \ +               and not ("geo_lat" in item and "geo_long" in item):                  continue              cls = None              dct = {'origin':self.importer_instance.origin,                     'license':self.importer_instance.license} -            if 'georss_point' in item: +            if 'georss_point' in item or "geo_lat" in item:                  cls = Marker -                try: -                    y, x = item['georss_point'].split(' ') -                except ValueError: -                    continue +                if 'georss_point' in item: +                    try: +                        y, x = item['georss_point'].split(' ') +                    except ValueError: +                        continue +                else: +                    y = item['geo_lat'] +                    x = item['geo_long']                  dct['point'] = 'SRID=4326;POINT(%s %s)' % (x, y)                  for k in ['description', 'summary', 'value']:                      if k in item: | 
