# HG changeset patch # User Paul Boddie # Date 1332781612 -7200 # Node ID 2993b322f87cd3fe37008b1c26bc4bb289727dac # Parent f08fd0062b5be576f273834a4b6b38e04e0ca1a0 Re-added the getLocationPosition function from LocationSupport. diff -r f08fd0062b5b -r 2993b322f87c EventAggregatorSupport.py --- a/EventAggregatorSupport.py Mon Mar 26 00:22:45 2012 +0200 +++ b/EventAggregatorSupport.py Mon Mar 26 19:06:52 2012 +0200 @@ -93,6 +93,24 @@ else: return None +def getLocationPosition(location, locations): + + """ + Attempt to return the position of the given 'location' using the 'locations' + dictionary provided. If no position can be found, return a latitude of None + and a longitude of None. + """ + + latitude, longitude = None, None + + if location is not None: + try: + latitude, longitude = map(getMapReference, locations[location].split()) + except (KeyError, ValueError): + pass + + return latitude, longitude + def to_list(s, sep): return [x.strip() for x in s.split(sep) if x.strip()]