[Toaster] V2 [review-request] 6040, 7249, and 7461: daterange filtering for builds page, filter counts

Reyna, David david.reyna at windriver.com
Wed Mar 25 09:08:50 PDT 2015


Hi Belén,

Perhaps you have an empty build database, where there is no first() nor last(). That would explain the symptoms.

I will post a patch as soon as I can.

- David

> -----Original Message-----
> From: Barros Pena, Belen [mailto:belen.barros.pena at intel.com]
> Sent: Wednesday, March 25, 2015 6:18 AM
> To: Reyna, David
> Cc: toaster at yoctoproject.org
> Subject: Re: V2 [review-request] 6040, 7249, and 7461: daterange filtering
> for builds page, filter counts
> 
> I finally got around to have a look at the calendar functionality in the
> filters. I checked out dreyna/build_datepicker_6040, then cherry-picked
> this patch:
> 
> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=dreyna/bui
> ld_datepicker_static_6040&id=0ff40e0a3c9d625e135a8fa691f7ad6109fb5873
> 
> When I go to the 'all builds' page or to the 'project builds' page I get
> this error:
> 
> Environment:
> 
> 
> Request Method: GET
> Request URL:
> http://127.0.0.1:8000/toastergui/builds/?count=10&orderby=completed_on%3A-&
> page=1
> 
> Django Version: 1.6
> Python Version: 2.7.6
> Installed Applications:
> ('django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.messages',
> 'django.contrib.sessions',
> 'django.contrib.admin',
> 'django.contrib.staticfiles',
> 'django.contrib.humanize',
> 'orm',
> 'toastermain',
> 'south',
> 'bldcontrol',
> 'bldviewer',
> 'toastergui')
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware')
> 
> 
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
> in get_response
>   114.                     response = wrapped_callback(request,
> *callback_args, **callback_kwargs)
> File "/home/yocto/master/bitbake/lib/toaster/toastergui/views.py" in builds
>   1879.             context, pagesize, orderby =
> _build_list_helper(request, buildrequests, True)
> File "/home/yocto/master/bitbake/lib/toaster/toastergui/views.py" in
> _build_list_helper
>   2017.         context_date,today_begin,yesterday_begin =
> _add_daterange_context(queryset_all, request, {'created','updated'})
> File "/home/yocto/master/bitbake/lib/toaster/toastergui/views.py" in
> _add_daterange_context
>   337.
> context_date['dateMin_'+key]=timezone.localtime(getattr(queryset_key.first(
> ),key)).strftime("%d/%m/%Y")
> 
> Exception Type: AttributeError at /toastergui/builds/
> Exception Value: 'NoneType' object has no attribute 'updated'
> 
> ************************
> 
> 
> Am I doing something wrong?
> 
> Cheers
> 
> Belén
> 
> On 24/03/2015 17:00, "Damian, Alexandru" <alexandru.damian at intel.com>
> wrote:
> 
> >Yes, the static resources patch is what I've modified -
> >
> >
> >I've moved the the files from "images"  to "css/images" to match the
> >paths defined in the jquery ui theme file.
> >
> >
> >Alex
> >
> >
> >
> >On Tue, Mar 24, 2015 at 4:52 PM, Reyna, David L (Wind River)
> ><david.reyna at windriver.com> wrote:
> >
> >Thanks!
> >
> >I assume so, but I am just checking, did you also get the separate commit
> >with the static resources?
> >
> >
> >    dreyna/build_datepicker_static_6040
> >
> >- Davd
> >
> >From: Damian, Alexandru [mailto:alexandru.damian at intel.com]
> >
> >Sent: Tuesday, March 24, 2015 9:49 AM
> >To: Reyna, David
> >Cc: WOOD, MICHAEL; BARROS PENA, BELEN;
> >toaster at yoctoproject.org <mailto:toaster at yoctoproject.org>
> >Subject: Re: V2 [review-request] 6040, 7249, and 7461: daterange
> >filtering for builds page, filter counts
> >
> >
> >
> >Taken as noted on the other mail thread.
> >
> >Alex
> >
> >
> >
> >On Sun, Mar 22, 2015 at 1:59 AM, Reyna, David <david.reyna at windriver.com>
> >wrote:
> >Hi Michael and Belén,
> >
> >
> >
> >I have created a V2 of the date range patch to address Michael¹s
> >recommendations:
> >
> >
> >
> >1) This patch includes 7461 ³Filters not working as designed²
> >
> >
> >
> >I hid the filter counts and turned off the button disables. I did keep
> >the backend code around so that we reuse/adapt it later.
> >
> >
> >
> >2) The javascript from ³filtersnippet.html² has been moved to
> >³/static/js/filtersnippet.js"
> >
> >
> >
> >To compensate I have added context values (to pass the values) and
> >³data-*² attributes (to hold the data with the respective controls). The
> >latter is needed because ³datepicker²
> > loses all its settings when its input box is disabled, so I have to be
> >able to restore the state on the fly.
> >
> >
> >
> >A side benefit is that I was able to remove almost all of the added
> >unnamed tuple variables. I left just one so that I did not have to
> >re-write Belén dense hover pop-up that
> > allows one to switch the filter back to ³Show All², but we are otherwise
> >no worse than Toast-1.7.
> >
> >
> >
> >FYI, I found I had to use DOM to fetch some elements in these routines,
> >because jQuery just could not find those same elements.
> >
> >
> >
> >3) There is no longer a page redirect to validate/reconstitute the
> >dynamic date range filter
> >
> >
> >
> >To compensation I have added a routine to catch and modify the
> >filter_string after it is fetched but before it is used, plus I added
> >some more context variables.
> >
> >
> >
> >FYI, I spent a lot of time trying to do the whole validation and
> >reparsing of the date range filter string in the javascript before it is
> >returned to the view classes, but
> > I finally gave up when I discovered that the date() support in
> >javascript does not support date addition. This feature is needed because
> >the ³to² date is expected to include that date, and that in turn means it
> >must be incremented to the beginning of the next
> > day before being used. (I could have played with fetching the object¹s
> >UNIX time integer, adding a day¹s worth of seconds, and making a new Date
> >object, but that looked ugly and un-safe).
> >
> >
> >
> >4) Various other style improvements
> >
> >
> >
> >I have tested it in managed and interactive mode, using valid and
> >empty/in-valid dates (which are caught and forced to Œtoday¹).
> >
> >
> >
> >The only usage oddity is that if you do use Belén hover pop-up to switch
> >the filter back to ³Show All², the date range pickers lose their previous
> >values (since they are
> > passed in the URL), but that is a small thing and the values are easily
> >re-entered. We can fix that when we update our persistence model in
> >YP-1.9.
> >
> >
> >
> >- David
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >--
> >Alex Damian
> >Yocto Project
> >
> >SSG / OTC
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >--
> >Alex Damian
> >Yocto Project
> >
> >SSG / OTC
> >
> >
> >
> 



More information about the toaster mailing list