]> git.ipfire.org Git - ipfire.org.git/commitdiff
accounts: Only try parsing dates when we have a value
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 15 Aug 2019 14:38:01 +0000 (15:38 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 15 Aug 2019 14:38:01 +0000 (15:38 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/accounts.py

index fe65126c2d49b75098aca381fd3e65b3c781951a..71253a44b6fda195ec53b68d69e98ecdf90ede04 100644 (file)
@@ -336,7 +336,8 @@ class Account(Object):
                value = self._get_string(key)
 
                # Parse the timestamp value and returns a datetime object
-               return datetime.datetime.strptime(value, "%Y%m%d%H%M%SZ")
+               if value:
+                       return datetime.datetime.strptime(value, "%Y%m%d%H%M%SZ")
 
        def _modify(self, modlist):
                logging.debug("Modifying %s: %s" % (self.dn, modlist))