Fix date validation while creating new role.

Fixes #1370
pull/3/head
Murtuza Zabuawala 2016-06-20 10:11:42 +01:00 committed by Dave Page
parent ac37d60c03
commit 01801e4acb
1 changed files with 3 additions and 1 deletions

View File

@ -137,7 +137,9 @@ class RoleView(PGChildNodeView):
# Make date explicit so that it works with every
# postgres database datestyle format
try:
if data[u'rolvaliduntil'] is not None:
if data[u'rolvaliduntil'] is not None and \
data[u'rolvaliduntil'] != '' and \
len(data[u'rolvaliduntil']) > 0:
date = datetime.datetime.strptime(
data[u'rolvaliduntil'], '%m/%d/%Y'
)