Commit 0f2d91c5 authored by Sebastien Robin's avatar Sebastien Robin

use a list of keywords instead of a dictionnary


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1950 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 733252df
......@@ -40,12 +40,18 @@ hour = 1/24.
same_movement_interval = hour
def addToDate(date, to_add={'year':0, 'month':0, 'day':0, 'hour':0, 'minute':0, 'second':0}):
#def addToDate(date, to_add={'year':0, 'month':0, 'day':0, 'hour':0, 'minute':0, 'second':0},year=0,month=0,day=0,
# hour=0,minute=0,second=0):
def addToDate(date,to_add=None, **kw):
"""
Return a new DateTime object with the corresponding added values.
Values can be negative.
"""
return_value = {}
if to_add is not None:
kw.update(to_add)
to_add = kw
#to_add.update(kw)
for key in ('year', 'month', 'day', 'hour', 'minute', 'second'):
method = getattr(date, key)
return_value[key] = method()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment