Commit 5c7710dd authored by Nicolas Delaby's avatar Nicolas Delaby

Remove useless Lines, cosmetic

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19147 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 066d31ae
...@@ -70,20 +70,24 @@ def addToDate(date, to_add=None, **kw): ...@@ -70,20 +70,24 @@ def addToDate(date, to_add=None, **kw):
for key in reverse_key_list: for key in reverse_key_list:
method = getattr(date, key) method = getattr(date, key)
return_value[key] = method() return_value[key] = method()
larger_key_dict = { 'second':'minute', larger_key_dict = { 'second':'minute',
'minute':'hour', 'minute':'hour',
'hour' :'day', 'hour' :'day',
'month' :'year' } 'month' :'year' }
number_of_in_dict = { 'second' : number_of_seconds_in_minute, number_of_in_dict = { 'second' : number_of_seconds_in_minute,
'minute' : number_of_minutes_in_hour, 'minute' : number_of_minutes_in_hour,
'hour' : number_of_hours_in_day, 'hour' : number_of_hours_in_day,
'day' : getNumberOfDayInMonth(date), 'day' : getNumberOfDayInMonth(date),
'month' : number_of_months_in_year } 'month' : number_of_months_in_year }
lesser_key_dict = {'minute':'second', lesser_key_dict = {'minute':'second',
'hour' :'minute', 'hour' :'minute',
'day' :'hour', 'day' :'hour',
'month' :'day', 'month' :'day',
'year' :'month'} 'year' :'month'}
number_less_of_in_dict = {'minute' : number_of_seconds_in_minute, number_less_of_in_dict = {'minute' : number_of_seconds_in_minute,
'hour' : number_of_minutes_in_hour, 'hour' : number_of_minutes_in_hour,
'day' : number_of_hours_in_day, 'day' : number_of_hours_in_day,
...@@ -110,6 +114,7 @@ def addToDate(date, to_add=None, **kw): ...@@ -110,6 +114,7 @@ def addToDate(date, to_add=None, **kw):
if key not in ('day', 'year'): if key not in ('day', 'year'):
treatNegativeValues(return_value, key) treatNegativeValues(return_value, key)
treatPositiveValues(return_value, key) treatPositiveValues(return_value, key)
for key in reverse_key_list[:-1]: for key in reverse_key_list[:-1]:
if 1 > return_value[key] % 1 > 0: if 1 > return_value[key] % 1 > 0:
return_value[lesser_key_dict[key]] += return_value[key] % 1 * number_less_of_in_dict[key] return_value[lesser_key_dict[key]] += return_value[key] % 1 * number_less_of_in_dict[key]
...@@ -117,11 +122,6 @@ def addToDate(date, to_add=None, **kw): ...@@ -117,11 +122,6 @@ def addToDate(date, to_add=None, **kw):
for local_key in return_value.keys(): for local_key in return_value.keys():
if local_key not in ('day', 'year'): if local_key not in ('day', 'year'):
treatPositiveValues(return_value, local_key) treatPositiveValues(return_value, local_key)
if key in ('day', 'year') and to_add.get(key, None) is not None:
del to_add[key]
if to_add.get('year', None) is not None:
return_value['year'] = return_value['year'] + to_add['year']
day_to_add = return_value['day'] - 1 day_to_add = return_value['day'] - 1
if to_add.get('day', None) is not None: if to_add.get('day', None) is not None:
......
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