1.1 --- a/EventAggregatorSupport.py Sun Aug 07 01:23:44 2011 +0200
1.2 +++ b/EventAggregatorSupport.py Sun Aug 07 14:44:42 2011 +0200
1.3 @@ -764,10 +764,10 @@
1.4 elif term in ("topics", "categories"):
1.5 desc = map(getSimpleWikiText, to_list(desc, ","))
1.6
1.7 - # Position details (using degrees:minutes:seconds).
1.8 + # Position details.
1.9
1.10 elif term == "geo":
1.11 - desc = map(getMapReference, to_list(desc, ";"))
1.12 + desc = map(getMapReference, to_list(desc, None))
1.13
1.14 # Labels which may well be quoted.
1.15
1.16 @@ -879,6 +879,11 @@
1.17 elif term in ("title", "summary"):
1.18 desc = getEncodedWikiText(event_details[term])
1.19
1.20 + # Position details.
1.21 +
1.22 + elif term == "geo":
1.23 + desc = " ".join(map(str, event_details[term]))
1.24 +
1.25 # Text which need not be quoted, but it will be Wiki text.
1.26
1.27 elif term in ("description", "link", "location"):
1.28 @@ -2370,7 +2375,10 @@
1.29 self.seconds = seconds
1.30
1.31 def __repr__(self):
1.32 - return "Reference(%d, %d, %d)" % (self.degrees, self.minutes, self.seconds)
1.33 + return "Reference(%d, %d, %f)" % (self.degrees, self.minutes, self.seconds)
1.34 +
1.35 + def __str__(self):
1.36 + return "%d:%d:%f" % (self.degrees, self.minutes, self.seconds)
1.37
1.38 def __add__(self, other):
1.39 if not isinstance(other, Reference):
1.40 @@ -2433,7 +2441,21 @@
1.41
1.42 "Return a map reference by parsing the given 'value'."
1.43
1.44 - return Reference(*map(float, value.split(":")))
1.45 + if value.find(":") != -1:
1.46 + return getMapReferenceFromDMS(value)
1.47 + else:
1.48 + return getMapReferenceFromDecimal(value)
1.49 +
1.50 +def getMapReferenceFromDMS(value):
1.51 +
1.52 + """
1.53 + Return a map reference by parsing the given 'value' expressed as degrees,
1.54 + minutes, seconds.
1.55 + """
1.56 +
1.57 + values = value.split(":")
1.58 + values = map(int, values[:2]) + map(float, values[2:3])
1.59 + return Reference(*values)
1.60
1.61 def getMapReferenceFromDecimal(value):
1.62
2.1 --- a/README.txt Sun Aug 07 01:23:44 2011 +0200
2.2 +++ b/README.txt Sun Aug 07 14:44:42 2011 +0200
2.3 @@ -252,6 +252,13 @@
2.4 time zone information for the correct interpretation of time information in
2.5 those summaries. Thus, it is highly recommended that pytz be installed.
2.6
2.7 +New in EventAggregator 0.8 (Changes since EventAggregator 0.7)
2.8 +--------------------------------------------------------------
2.9 +
2.10 + * Added remote event aggregation with support for iCalendar event sources.
2.11 + * Added support for explicit latitude and longitude event properties.
2.12 + * Added support for decimal latitude and longitude values.
2.13 +
2.14 New in EventAggregator 0.7 (Changes since EventAggregator 0.6.4)
2.15 ----------------------------------------------------------------
2.16
3.1 --- a/actions/EventAggregatorNewEvent.py Sun Aug 07 01:23:44 2011 +0200
3.2 +++ b/actions/EventAggregatorNewEvent.py Sun Aug 07 14:44:42 2011 +0200
3.3 @@ -146,6 +146,10 @@
3.4 "description_default" : escattr(form.get("description", [""])[0]),
3.5 "location_label" : escape(_("Event location")),
3.6 "location_default" : escattr(form.get("location", [""])[0]),
3.7 + "latitude_label" : escape(_("Latitude")),
3.8 + "latitude_default" : escattr(form.get("latitude", [""])[0]),
3.9 + "longitude_label" : escape(_("Longitude")),
3.10 + "longitude_default" : escattr(form.get("longitude", [""])[0]),
3.11 "link_label" : escape(_("Event URL")),
3.12 "link_default" : escattr(form.get("link", [""])[0]),
3.13
3.14 @@ -346,6 +350,18 @@
3.15 </td>
3.16 </tr>
3.17 <tr>
3.18 + <td class="label"><label>%(latitude_label)s</label></td>
3.19 + <td colspan="2">
3.20 + <input name="latitude" type="text" size="40" value="%(latitude_default)s" />
3.21 + </td>
3.22 + </tr>
3.23 + <tr>
3.24 + <td class="label"><label>%(longitude_label)s</label></td>
3.25 + <td colspan="2">
3.26 + <input name="longitude" type="text" size="40" value="%(longitude_default)s" />
3.27 + </td>
3.28 + </tr>
3.29 + <tr>
3.30 <td class="label"><label>%(link_label)s</label></td>
3.31 <td colspan="2">
3.32 <input name="link" type="text" size="40" value="%(link_default)s" />
3.33 @@ -473,6 +489,8 @@
3.34 category_pagenames = form.get("category", [])
3.35 description = form.get("description", [None])[0]
3.36 location = form.get("location", [None])[0]
3.37 + latitude = form.get("latitude", [None])[0]
3.38 + longitude = form.get("longitude", [None])[0]
3.39 link = form.get("link", [None])[0]
3.40 topics = form.get("topics", [])
3.41
3.42 @@ -541,6 +559,9 @@
3.43 "topics" : [topic for topic in topics if topic]
3.44 }
3.45
3.46 + if latitude and longitude:
3.47 + event_details["geo"] = latitude, longitude
3.48 +
3.49 # Copy the template.
3.50
3.51 template_page = PageEditor(request, template)