aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-03-25 13:34:27 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-31 16:24:38 +0100
commitd028fbe76962f3b86239633a0951626dfa66b8af (patch)
treec28bff51faf05de88bdcf1e5917a169b782029a2
parent0153e0b4e089f62a7d5a92ca6be2fa5a8f61a6e4 (diff)
downloadbitbake-d028fbe76962f3b86239633a0951626dfa66b8af.tar.gz
toastergui: prevent error on empty build list
This patch prevents errors being thrown on date limit computations if the build list is empty. [YOCTO #7513] Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xlib/toaster/toastergui/views.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index fdd80222a..2f8fb1a8e 100755
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -334,8 +334,14 @@ def _add_daterange_context(queryset_all, request, daterange_list):
context_date['daterange_filter']=''
for key in daterange_list:
queryset_key = queryset_all.order_by(key)
- context_date['dateMin_'+key]=timezone.localtime(getattr(queryset_key.first(),key)).strftime("%d/%m/%Y")
- context_date['dateMax_'+key]=timezone.localtime(getattr(queryset_key.last(),key)).strftime("%d/%m/%Y")
+ try:
+ context_date['dateMin_'+key]=timezone.localtime(getattr(queryset_key.first(),key)).strftime("%d/%m/%Y")
+ except AttributeError:
+ context_date['dateMin_'+key]=timezone.localtime(timezone.now())
+ try:
+ context_date['dateMax_'+key]=timezone.localtime(getattr(queryset_key.last(),key)).strftime("%d/%m/%Y")
+ except AttributeError:
+ context_date['dateMax_'+key]=timezone.localtime(timezone.now())
return context_date,today_begin,yesterday_begin