Fix an error which cause on Feb 29 in user setting

In Feb 29(leap year), when users update user settings, error will occur.
Settings expiration is a year later and this calculation is incorrect.
This patch will fix it.

Change-Id: Id2bc6741ad3366969fbb73dc64c23430ce66f2aa
Closes-Bug: #1551099
This commit is contained in:
Kenji Ishii 2016-02-29 16:43:35 +09:00 committed by eric
parent 347023f35a
commit 79c531a1c4

View File

@ -13,6 +13,7 @@
# under the License. # under the License.
from datetime import datetime # noqa from datetime import datetime # noqa
from datetime import timedelta # noqa
import string import string
import babel import babel
@ -30,8 +31,7 @@ from horizon import messages
def _one_year(): def _one_year():
now = datetime.utcnow() now = datetime.utcnow()
return datetime(now.year + 1, now.month, now.day, now.hour, return now + timedelta(days=365)
now.minute, now.second, now.microsecond, now.tzinfo)
class UserSettingsForm(forms.SelfHandlingForm): class UserSettingsForm(forms.SelfHandlingForm):