Mercurial > p > roundup > code
comparison roundup/date.py @ 1505:c101d2ff5a20
fix to [SF#691071], really this time
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 10 Mar 2003 00:22:52 +0000 |
| parents | 8ee69708da0c |
| children | 1d4ebe2a88fc |
comparison
equal
deleted
inserted
replaced
| 1503:94ec56691f07 | 1505:c101d2ff5a20 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: date.py,v 1.46 2003-03-08 20:41:45 kedder Exp $ | 18 # $Id: date.py,v 1.47 2003-03-10 00:22:20 richard Exp $ |
| 19 | 19 |
| 20 __doc__ = """ | 20 __doc__ = """ |
| 21 Date, time and time interval handling. | 21 Date, time and time interval handling. |
| 22 """ | 22 """ |
| 23 | 23 |
| 352 self.second = spec | 352 self.second = spec |
| 353 | 353 |
| 354 def __cmp__(self, other): | 354 def __cmp__(self, other): |
| 355 """Compare this interval to another interval.""" | 355 """Compare this interval to another interval.""" |
| 356 if other is None: | 356 if other is None: |
| 357 # we are always larger than None | |
| 357 return 1 | 358 return 1 |
| 358 for attr in 'sign year month day hour minute second'.split(): | 359 for attr in 'sign year month day hour minute second'.split(): |
| 359 if not hasattr(other, attr): | |
| 360 return 1 | |
| 361 r = cmp(getattr(self, attr), getattr(other, attr)) | 360 r = cmp(getattr(self, attr), getattr(other, attr)) |
| 362 if r: | 361 if r: |
| 363 return r | 362 return r |
| 364 return 0 | 363 return 0 |
| 365 | 364 |
