diff options
Diffstat (limited to 'scripts/rpki/sundial.py')
-rw-r--r-- | scripts/rpki/sundial.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/rpki/sundial.py b/scripts/rpki/sundial.py index 0703ff22..a1ffde62 100644 --- a/scripts/rpki/sundial.py +++ b/scripts/rpki/sundial.py @@ -75,12 +75,18 @@ class datetime(pydatetime.datetime): @classmethod def fromXMLtime(cls, x): """Convert from XML time representation.""" - return cls.strptime(x, "%Y-%m-%dT%H:%M:%SZ") + if x is None: + return None + else: + return cls.strptime(x, "%Y-%m-%dT%H:%M:%SZ") def toXMLtime(self): """Convert to XML time representation.""" return self.strftime("%Y-%m-%dT%H:%M:%SZ") + def __str__(self): + return self.toXMLtime() + @classmethod def fromdatetime(cls, x): """Convert a datetime.datetime object into this subclass. |