Fix OBSLock to always write full ISO format

If the microseconds are 0, isoformat won't output any, but our _parse
function expects them. python 3.7 has isoformat/fromisoformat, which
would fix it, but we can't take it atm
This commit is contained in:
Stephan Kulow 2019-04-24 08:46:54 +02:00
parent 0693c88977
commit 5f3dcca267

View File

@ -33,7 +33,7 @@ class OBSLock(object):
if self.reason_sub:
reason += ' ({})'.format(self.reason_sub)
reason = reason.replace('@', 'at').replace('#', 'hash')
return '%s#%s@%s' % (self.user, reason, datetime.isoformat(datetime.utcnow()))
return '%s#%s@%s' % (self.user, reason, datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.%f'))
def _parse(self, signature):
"""Parse a signature into an user and a timestamp."""