# HG changeset patch # User Paul Boddie # Date 1301790666 -7200 # Node ID 0c7952a36a959fe159559b13e800317eed567aa3 # Parent 652db398c50581429f26b612f4adff1a4f6734e7 Fixed the TimespanCollection.insert_in_order method, ensuring that the resolution is upheld when comparing values. Improved the Event.as_limits method, testing for and returning null timespans. Added a more useful string representation for Event instances. diff -r 652db398c505 -r 0c7952a36a95 EventAggregatorSupport.py --- a/EventAggregatorSupport.py Sun Apr 03 02:07:19 2011 +0200 +++ b/EventAggregatorSupport.py Sun Apr 03 02:31:06 2011 +0200 @@ -679,6 +679,9 @@ self.page = page self.details = details + def __repr__(self): + return "" % (self.getSummary(), self.as_limits()) + def __hash__(self): return hash(self.getSummary()) @@ -753,7 +756,8 @@ return None def as_limits(self): - return self.as_timespan().as_limits() + ts = self.as_timespan() + return ts and ts.as_limits() def getEventsFromPages(pages): @@ -1666,7 +1670,8 @@ return self.values.pop() def insert_in_order(self, value): - bisect.insort_left(self, value) + i = bisect.bisect_left(self, self.convert(value)) + self.insert(i, value) def items_in_range(self, start, end): slice_start = bisect.bisect_left(self, start)