Use ISO formatted dates when setting rolvaluntil. Fixes #1153

pull/3/head
Murtuza Zabuawala 2016-09-02 15:24:34 +01:00 committed by Dave Page
parent 842d078142
commit f3f7413701
1 changed files with 3 additions and 6 deletions

View File

@ -145,7 +145,7 @@ class RoleView(PGChildNodeView):
date = datetime.datetime.strptime(
data[u'rolvaliduntil'], '%m/%d/%Y'
)
data[u'rolvaliduntil'] = date.strftime("%d-%B-%Y")
data[u'rolvaliduntil'] = date.strftime("%Y-%m-%d")
except Exception as e:
return precondition_required(
_("Date format is invalid.")
@ -640,11 +640,8 @@ rolmembership:{
'admin': True if role.group(1) == '1' else False
})
row['rolmembership'] = res
row['rolvaliduntil'] = row['rolvaliduntil'].isoformat() \
if isinstance(
row['rolvaliduntil'],
(datetime.date, datetime.datetime)
) else None
if row['rolvaliduntil'] is not None:
row['rolvaliduntil'] = row['rolvaliduntil'].split(' ')[0]
if 'seclabels' in row and row['seclabels'] is not None:
res = []
for sec in row['seclabels']: