ia64/xen-unstable
changeset 14853:0ab8f81019a5
Fix TypeError with datetime() on old python version
signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
author | Tom Wilkie <tom.wilkie@gmail.com> |
---|---|
date | Fri Apr 13 16:02:41 2007 +0100 (2007-04-13) |
parents | 22460cfaca71 |
children | 039daabebad5 |
files | tools/python/xen/xend/XendAPI.py |
line diff
1.1 --- a/tools/python/xen/xend/XendAPI.py Fri Apr 13 15:24:42 2007 +0100 1.2 +++ b/tools/python/xen/xend/XendAPI.py Fri Apr 13 16:02:41 2007 +0100 1.3 @@ -96,7 +96,10 @@ def datetime(when = None): 1.4 @param when The time in question, given as seconds since the epoch, UTC. 1.5 May be None, in which case the current time is used. 1.6 """ 1.7 - return xmlrpclib.DateTime(time.gmtime(when)) 1.8 + if when is None: 1.9 + return xmlrpclib.DateTime(time.gmtime()) 1.10 + else: 1.11 + return xmlrpclib.DateTime(time.gmtime(when)) 1.12 1.13 1.14 # ---------------------------------------------------