[oe-commits] [bitbake] 17/21: buildinfohelper: ensure task datetimes are timezone-aware
git at git.openembedded.org
git at git.openembedded.org
Fri Jul 8 09:00:03 UTC 2016
rpurdie pushed a commit to branch master
in repository bitbake.
commit df9f4337bec87024ea6a43138c6080a755eb7fab
Author: Elliot Smith <elliot.smith at intel.com>
AuthorDate: Wed Jul 6 12:00:35 2016 +0100
buildinfohelper: ensure task datetimes are timezone-aware
When using toaster-eventreplay to run a bitbake event file
through toasterui/buildinfohelper, errors occur when the
tasks are updated with buildstats info:
RuntimeWarning: DateTimeField Task.started received a naive
datetime (2016-07-06 09:15:22.070000) while time zone support
is active.
This is because a method in buildinfohelper returns a naive
datetime, but Django is expecting timezone-aware datetimes.
Ensure that datetimes used to set the started/ended times on
tasks are converted to timezone-aware datetimes.
Signed-off-by: Elliot Smith <elliot.smith at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/ui/buildinfohelper.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index d5ba629..447670c 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -125,7 +125,7 @@ class ORMWrapper(object):
"""
Convert timestamp in seconds to Python datetime
"""
- return datetime(1970, 1, 1) + timedelta(seconds=secs)
+ return timezone.make_aware(datetime(1970, 1, 1) + timedelta(seconds=secs))
# pylint: disable=no-self-use
# we disable detection of no self use in functions because the methods actually work on the object
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list