# HG changeset patch # User Paul Boddie # Date 1312721082 -7200 # Node ID 672192f6f324b0ddece0fc165031331714f9222e # Parent 3a366104152eb0002e81039ec4f9a2c3468cec4c Fixed the explicit latitude and longitude separator in page-based events. Added support for decimal degrees in maps and location descriptions and for explicit positions. Added serialisation of "geo" properties in pages and support for specifying latitude and longitude explicitly in the new event action. Updated the release notes. diff -r 3a366104152e -r 672192f6f324 EventAggregatorSupport.py --- a/EventAggregatorSupport.py Sun Aug 07 01:23:44 2011 +0200 +++ b/EventAggregatorSupport.py Sun Aug 07 14:44:42 2011 +0200 @@ -764,10 +764,10 @@ elif term in ("topics", "categories"): desc = map(getSimpleWikiText, to_list(desc, ",")) - # Position details (using degrees:minutes:seconds). + # Position details. elif term == "geo": - desc = map(getMapReference, to_list(desc, ";")) + desc = map(getMapReference, to_list(desc, None)) # Labels which may well be quoted. @@ -879,6 +879,11 @@ elif term in ("title", "summary"): desc = getEncodedWikiText(event_details[term]) + # Position details. + + elif term == "geo": + desc = " ".join(map(str, event_details[term])) + # Text which need not be quoted, but it will be Wiki text. elif term in ("description", "link", "location"): @@ -2370,7 +2375,10 @@ self.seconds = seconds def __repr__(self): - return "Reference(%d, %d, %d)" % (self.degrees, self.minutes, self.seconds) + return "Reference(%d, %d, %f)" % (self.degrees, self.minutes, self.seconds) + + def __str__(self): + return "%d:%d:%f" % (self.degrees, self.minutes, self.seconds) def __add__(self, other): if not isinstance(other, Reference): @@ -2433,7 +2441,21 @@ "Return a map reference by parsing the given 'value'." - return Reference(*map(float, value.split(":"))) + if value.find(":") != -1: + return getMapReferenceFromDMS(value) + else: + return getMapReferenceFromDecimal(value) + +def getMapReferenceFromDMS(value): + + """ + Return a map reference by parsing the given 'value' expressed as degrees, + minutes, seconds. + """ + + values = value.split(":") + values = map(int, values[:2]) + map(float, values[2:3]) + return Reference(*values) def getMapReferenceFromDecimal(value): diff -r 3a366104152e -r 672192f6f324 README.txt --- a/README.txt Sun Aug 07 01:23:44 2011 +0200 +++ b/README.txt Sun Aug 07 14:44:42 2011 +0200 @@ -252,6 +252,13 @@ time zone information for the correct interpretation of time information in those summaries. Thus, it is highly recommended that pytz be installed. +New in EventAggregator 0.8 (Changes since EventAggregator 0.7) +-------------------------------------------------------------- + + * Added remote event aggregation with support for iCalendar event sources. + * Added support for explicit latitude and longitude event properties. + * Added support for decimal latitude and longitude values. + New in EventAggregator 0.7 (Changes since EventAggregator 0.6.4) ---------------------------------------------------------------- diff -r 3a366104152e -r 672192f6f324 actions/EventAggregatorNewEvent.py --- a/actions/EventAggregatorNewEvent.py Sun Aug 07 01:23:44 2011 +0200 +++ b/actions/EventAggregatorNewEvent.py Sun Aug 07 14:44:42 2011 +0200 @@ -146,6 +146,10 @@ "description_default" : escattr(form.get("description", [""])[0]), "location_label" : escape(_("Event location")), "location_default" : escattr(form.get("location", [""])[0]), + "latitude_label" : escape(_("Latitude")), + "latitude_default" : escattr(form.get("latitude", [""])[0]), + "longitude_label" : escape(_("Longitude")), + "longitude_default" : escattr(form.get("longitude", [""])[0]), "link_label" : escape(_("Event URL")), "link_default" : escattr(form.get("link", [""])[0]), @@ -346,6 +350,18 @@ + + + + + + + + + + + + @@ -473,6 +489,8 @@ category_pagenames = form.get("category", []) description = form.get("description", [None])[0] location = form.get("location", [None])[0] + latitude = form.get("latitude", [None])[0] + longitude = form.get("longitude", [None])[0] link = form.get("link", [None])[0] topics = form.get("topics", []) @@ -541,6 +559,9 @@ "topics" : [topic for topic in topics if topic] } + if latitude and longitude: + event_details["geo"] = latitude, longitude + # Copy the template. template_page = PageEditor(request, template)