comparison roundup/date.py @ 2729:797725ec50c5

date.Interval() now accepts an Interval as a spec [SF#1041266]
author Richard Jones <richard@users.sourceforge.net>
date Fri, 08 Oct 2004 00:32:34 +0000
parents eb4e7b8d52a2
children ad04cb95e2b0
comparison
equal deleted inserted replaced
2727:93e2e5b55a3c 2729:797725ec50c5
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.75 2004-09-29 07:27:08 richard Exp $ 18 # $Id: date.py,v 1.76 2004-10-08 00:32:34 richard Exp $
19 19
20 """Date, time and time interval handling. 20 """Date, time and time interval handling.
21 """ 21 """
22 __docformat__ = 'restructuredtext' 22 __docformat__ = 'restructuredtext'
23 23
474 self.setTranslator(translator) 474 self.setTranslator(translator)
475 if type(spec) in (IntType, FloatType, LongType): 475 if type(spec) in (IntType, FloatType, LongType):
476 self.from_seconds(spec) 476 self.from_seconds(spec)
477 elif type(spec) in (StringType, UnicodeType): 477 elif type(spec) in (StringType, UnicodeType):
478 self.set(spec, allowdate=allowdate, add_granularity=add_granularity) 478 self.set(spec, allowdate=allowdate, add_granularity=add_granularity)
479 elif isinstance(spec, Interval):
480 (self.sign, self.year, self.month, self.day, self.hour,
481 self.minute, self.second) = spec.get_tuple()
479 else: 482 else:
480 if len(spec) == 7: 483 if len(spec) == 7:
481 self.sign, self.year, self.month, self.day, self.hour, \ 484 self.sign, self.year, self.month, self.day, self.hour, \
482 self.minute, self.second = spec 485 self.minute, self.second = spec
483 self.second = int(self.second) 486 self.second = int(self.second)

Roundup Issue Tracker: http://roundup-tracker.org/