# HG changeset patch # User Paul Boddie # Date 1367422686 -7200 # Node ID 92c9070fd5f6c5969abe78c0102fa6ae1dee83bf # Parent 9286eac9fc723f7410844b3de9437efa6cb75944 Added conversion of summary and URL event properties to string values where vContent has detected a collection of values (perhaps due to incorrect encoding of such property values). diff -r 9286eac9fc72 -r 92c9070fd5f6 EventAggregatorSupport/Types.py --- a/EventAggregatorSupport/Types.py Wed May 01 15:50:34 2013 +0200 +++ b/EventAggregatorSupport/Types.py Wed May 01 17:38:06 2013 +0200 @@ -708,9 +708,35 @@ def getEventURL(self): - "Return the URL of this event." + """ + Return the URL of this event, fixing any misinterpreted or incorrectly + formatted value in the event definition or returning the resource URL in + the absence of any URL in the event details. + """ + + return self.details.get("url") and \ + self.valueToString(self.details["url"]) or \ + self.page.getPageURL() + + def getSummary(self, event_parent=None): - return self.details.get("url") or self.page.getPageURL() + """ + Return the event summary, fixing any misinterpreted or incorrectly + formatted value in the event definition. + """ + + return self.valueToString(self.details["summary"]) + + def valueToString(self, value): + + "Return the given 'value' converted to a string." + + if isinstance(value, list): + return ",".join(value) + elif isinstance(value, tuple): + return ";".join(value) + else: + return value def linkToEvent(self, request, text, query_string=None, anchor=None):