# HG changeset patch # User Paul Boddie # Date 1305243386 -7200 # Node ID ae1a2e8398a116ddb39dc1d4e01d38482b73a44a # Parent 06b90003d8a54ddc4c0a2ed745e64c3a5fddbbe3 Fixed the positioning, avoiding event locations set to None. Extended the normalised location recognition to permit multi-word areas or towns whilst excluding postcodes. diff -r 06b90003d8a5 -r ae1a2e8398a1 EventAggregatorSupport.py --- a/EventAggregatorSupport.py Wed May 11 00:45:47 2011 +0200 +++ b/EventAggregatorSupport.py Fri May 13 01:36:26 2011 +0200 @@ -50,7 +50,12 @@ # Value parsing. country_code_regexp = re.compile(ur'(?:^|\W)(?P[A-Z]{2})(?:$|\W+$)', re.UNICODE) -location_normalised_regexp = re.compile(ur"([\w-]+(?:,(?:\s*[\w-]+)+)?)$", re.UNICODE) +location_normalised_regexp = re.compile( + ur"(?:\d+\w*\s+)?" # preceding postcode (optional) + ur"(?P" # start of group of interest + ur"\w[\w\s-]+?" # area or town + ur"(?:,(?:\s*[\w-]+)+)?" # country (optional) + ur")$", re.UNICODE) month_regexp_str = ur'(?P[0-9]{4})-(?P[0-9]{2})' date_regexp_str = ur'(?P[0-9]{4})-(?P[0-9]{2})-(?P[0-9]{2})' @@ -334,7 +339,7 @@ match = location_normalised_regexp.search(location) if match: - return match.group() + return match.group("location") else: return None diff -r 06b90003d8a5 -r ae1a2e8398a1 macros/EventAggregator.py --- a/macros/EventAggregator.py Wed May 11 00:45:47 2011 +0200 +++ b/macros/EventAggregator.py Fri May 13 01:36:26 2011 +0200 @@ -1549,7 +1549,7 @@ location = event_details.get("location") - if not event_locations.has_key(location): + if location is not None and not event_locations.has_key(location): # Look up the position of a location using the locations page.