Fix date validation while creating new role.

Fixes #1370
This commit is contained in:
Murtuza Zabuawala authored and Dave Page committed 2016-06-20 10:11:42 +01:00
1 parent ac37d60c03
commit 01801e4acb
1 file changed
+3 -1
@@ -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'
)