1.1 --- a/EventAggregatorSupport.py Mon Apr 18 01:06:30 2011 +0200
1.2 +++ b/EventAggregatorSupport.py Mon Apr 18 23:43:22 2011 +0200
1.3 @@ -50,6 +50,7 @@
1.4 # Value parsing.
1.5
1.6 country_code_regexp = re.compile(ur'(?:^|\W)(?P<code>[A-Z]{2})(?:$|\W+$)', re.UNICODE)
1.7 +location_normalised_regexp = re.compile(ur"([\w-]+(?:,(?:\s*[\w-]+)+)?)$", re.UNICODE)
1.8
1.9 month_regexp_str = ur'(?P<year>[0-9]{4})-(?P<month>[0-9]{2})'
1.10 date_regexp_str = ur'(?P<year>[0-9]{4})-(?P<month>[0-9]{2})-(?P<day>[0-9]{2})'
1.11 @@ -308,6 +309,19 @@
1.12
1.13 return weekday_labels[weekday]
1.14
1.15 +def getNormalisedLocation(location):
1.16 +
1.17 + """
1.18 + Attempt to return a normalised 'location' of the form "<town>, <country>" or
1.19 + "<town>".
1.20 + """
1.21 +
1.22 + match = location_normalised_regexp.search(location)
1.23 + if match:
1.24 + return match.group()
1.25 + else:
1.26 + return None
1.27 +
1.28 # Action support functions.
1.29
1.30 def getPageRevision(page):
2.1 --- a/css/event-aggregator-print.css Mon Apr 18 01:06:30 2011 +0200
2.2 +++ b/css/event-aggregator-print.css Mon Apr 18 23:43:22 2011 +0200
2.3 @@ -104,7 +104,6 @@
2.4 position: static !important;
2.5 display: block;
2.6 visibility: visible;
2.7 - margin: 0.5em;
2.8 padding: 0.5em;
2.9 border: 1px solid #ddd;
2.10 }
3.1 --- a/macros/EventAggregator.py Mon Apr 18 01:06:30 2011 +0200
3.2 +++ b/macros/EventAggregator.py Mon Apr 18 23:43:22 2011 +0200
3.3 @@ -1496,6 +1496,11 @@
3.4 event_details = event.getDetails()
3.5
3.6 location = event_details.get("location")
3.7 +
3.8 + # Use a normalised location if possible.
3.9 +
3.10 + location = location and getNormalisedLocation(location) or location
3.11 +
3.12 if not events_by_location.has_key(location):
3.13 events_by_location[location] = []
3.14 events_by_location[location].append(event)