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.
from datetime import datetime # noqa
from datetime import timedelta # noqa
import string
import babel
@ -30,8 +31,7 @@ from horizon import messages
def _one_year():
now = datetime.utcnow()
return datetime(now.year + 1, now.month, now.day, now.hour,
now.minute, now.second, now.microsecond, now.tzinfo)
return now + timedelta(days=365)
class UserSettingsForm(forms.SelfHandlingForm):