Mercurial > p > roundup > code
comparison roundup/date.py @ 248:96cdd8ef0581
Added some more help to roundup-admin
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 18 Sep 2001 22:58:37 +0000 |
| parents | 0dfe39b4fa17 |
| children | bdc2ea127ae9 |
comparison
equal
deleted
inserted
replaced
| 247:6aae5aaeab27 | 248:96cdd8ef0581 |
|---|---|
| 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.12 2001-08-17 03:08:11 richard Exp $ | 18 # $Id: date.py,v 1.13 2001-09-18 22:58:37 richard Exp $ |
| 19 | 19 |
| 20 import time, re, calendar | 20 import time, re, calendar |
| 21 | 21 |
| 22 class Date: | 22 class Date: |
| 23 ''' | 23 ''' |
| 315 < 1 day | 315 < 1 day |
| 316 otherwise, return None (so a full date may be displayed) | 316 otherwise, return None (so a full date may be displayed) |
| 317 ''' | 317 ''' |
| 318 if self.year or self.month > 2: | 318 if self.year or self.month > 2: |
| 319 return None | 319 return None |
| 320 if self.month: | 320 if self.month or self.day > 13: |
| 321 days = (self.month * 30) + self.day | 321 days = (self.month * 30) + self.day |
| 322 if days > 28: | 322 if days > 28: |
| 323 return '%s months'%int(days/30) | 323 if int(days/30) > 1: |
| 324 return '%s months'%int(days/30) | |
| 325 else: | |
| 326 return '1 month' | |
| 324 else: | 327 else: |
| 325 return '%s weeks'%int(days/7) | 328 return '%s weeks'%int(days/7) |
| 326 if self.day > 7: | 329 if self.day > 7: |
| 327 return '1 week' | 330 return '1 week' |
| 328 if self.day > 1: | 331 if self.day > 1: |
| 374 if __name__ == '__main__': | 377 if __name__ == '__main__': |
| 375 test() | 378 test() |
| 376 | 379 |
| 377 # | 380 # |
| 378 # $Log: not supported by cvs2svn $ | 381 # $Log: not supported by cvs2svn $ |
| 382 # Revision 1.12 2001/08/17 03:08:11 richard | |
| 383 # fixed prettification of intervals of 1 week | |
| 384 # | |
| 379 # Revision 1.11 2001/08/15 23:43:18 richard | 385 # Revision 1.11 2001/08/15 23:43:18 richard |
| 380 # Fixed some isFooTypes that I missed. | 386 # Fixed some isFooTypes that I missed. |
| 381 # Refactored some code in the CGI code. | 387 # Refactored some code in the CGI code. |
| 382 # | 388 # |
| 383 # Revision 1.10 2001/08/07 00:24:42 richard | 389 # Revision 1.10 2001/08/07 00:24:42 richard |
