1.1 --- a/EventAggregatorSupport.py Mon Dec 20 01:18:48 2010 +0100
1.2 +++ b/EventAggregatorSupport.py Sun Jan 16 03:10:14 2011 +0100
1.3 @@ -2,7 +2,7 @@
1.4 """
1.5 MoinMoin - EventAggregator library
1.6
1.7 - @copyright: 2008, 2009, 2010 by Paul Boddie <paul@boddie.org.uk>
1.8 + @copyright: 2008, 2009, 2010, 2011 by Paul Boddie <paul@boddie.org.uk>
1.9 @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
1.10 2005-2008 MoinMoin:ThomasWaldmann.
1.11 @license: GNU GPL (v2 or later), see COPYING.txt for details.
1.12 @@ -943,6 +943,13 @@
1.13 return full_coverage, all_events
1.14
1.15 def getCoverageScale(coverage):
1.16 +
1.17 + """
1.18 + Return a scale for the given coverage so that the times involved are
1.19 + exposed. The scale consists of a list of non-overlapping timespans forming
1.20 + a contiguous period of time.
1.21 + """
1.22 +
1.23 times = set()
1.24 for timespan in coverage:
1.25 start, end = timespan.as_times()
1.26 @@ -960,6 +967,7 @@
1.27 else:
1.28 first = 0
1.29 start = time
1.30 +
1.31 return scale
1.32
1.33 # Date-related functions.
1.34 @@ -1193,6 +1201,14 @@
1.35 def as_date(self):
1.36 return Date(self.data[:3])
1.37
1.38 + def __cmp__(self, other):
1.39 + if isinstance(other, DateTime):
1.40 + self_utc = self.to_utc()
1.41 + other_utc = other.to_utc()
1.42 + if self_utc is not None and other_utc is not None:
1.43 + return cmp(self_utc.as_tuple(), other_utc.as_tuple())
1.44 + return Month.__cmp__(self, other)
1.45 +
1.46 def has_time(self):
1.47 return self.data[3] is not None and self.data[4] is not None
1.48