[Toaster] DRY RUN [Review Request] 4299 "recipes: View detailed information about a recipe"

Reyna, David david.reyna at windriver.com
Wed Jan 15 07:19:19 PST 2014


Hi Ravi,

> I added the custom tag and pushed it yesterday:

I am glad you got it working. Is this in your private branch? I missed the review request email if not.

> {% load projecttags %}

I was indeed missing this. Shouldn't something as fundamental as this be part of the "basebuild[details]page.html"? I had assumed so and thus got into trouble.

> return 'style=color:red' else: return 'style=color:black'

By the way, Belen had defined these class colors in her CSS style sheet...

  'class=error'
  'class=muted'

... where no color specified defaults to "color:black".

We may want to use her CSS values in case Belen changes her mind on the colors :-)

- David

> -----Original Message-----
> From: Ravi Chintakunta [mailto:ravi.chintakunta at timesys.com]
> Sent: Wednesday, January 15, 2014 4:10 AM
> To: Reyna, David; Damian, Alexandru
> Cc: toaster at yoctoproject.org
> Subject: RE: [Toaster] DRY RUN [Review Request] 4299 "recipes: View
> detailed information about a recipe"
> 
> Hi David,
> 
> I added the custom tag and pushed it yesterday:
> 
> http://git.yoctoproject.org/cgit/cgit.cgi/poky-
> contrib/commit/?h=ravi/all-tasks-
> feature&id=c04cbe928b0796a1a770399df7d10c7f7cb66ce7
> 
> You can see the usage of the tag here:
> 
> http://git.yoctoproject.org/cgit/cgit.cgi/poky-
> contrib/commit/?h=ravi/all-tasks-
> feature&id=844be60f5c5a73623a56a14689d9bbe6ee29a541
> 
> For the tag to be used, the projecttags has to be loaded in the file by
> calling:
> 
> {% load projecttags %}
> 
> 
> Thanks,
> Ravi
> ________________________________________
> From: toaster-bounces at yoctoproject.org [toaster-
> bounces at yoctoproject.org] On Behalf Of Reyna, David
> [david.reyna at windriver.com]
> Sent: Wednesday, January 15, 2014 1:34 AM
> To: Damian, Alexandru
> Cc: toaster at yoctoproject.org
> Subject: Re: [Toaster] DRY RUN [Review Request] 4299 "recipes: View
> detailed information about a recipe"
> 
> Hi Alex,
> 
> There is something seriously fragile about Django tags and filters.
> 
> 1) When I try to use "simple_tag", all I get is "Invalid block tag:
> 'task_outcome_highlight', expected 'empty' or 'endfor', even for the
> most trivial tag:
> 
> @register.filter
> def task_outcome_highlight(task)
>     return 'class=error'
> 
> ...and...
> 
> {% task_outcome_highlight task %}
> 
> 2) I then tried filters. I first used a filter out of the Djago docs,
> and it worked.
> 
> WORKS:
> 
> @register.filter(name='cut')
> def cut(value, arg):
>     """Removes all values of arg from the given string"""
>     return value.replace(arg, '')
> 
> ...and...
> 
> {{ "1230456"|cut:"0" }}
> 
> 3) However, if I make change to that filter, for example changing its
> name, I get nothing but filter format errors.
> 
> FAILS (when renamed to "cu"):
> 
> @register.filter(name='cu')
> def cu (value, arg):
>     """Removes all values of arg from the given string"""
>     return value.replace(arg, '')
> 
> ...and...
> 
> {{ "1230456"|cu:"0" }}
> 
> 4) I have tried stopping and starting the server. If I rename the
> filter back to "cut", it will start working again.
> 
> I have spent hours on something that should be done in 10 minutes.
> 
> - David
> 
> ========================
> 
> From: Damian, Alexandru [mailto:alexandru.damian at intel.com]
> Sent: Monday, January 13, 2014 5:43 AM
> To: Reyna, David
> Cc: Lerner, Dave; toaster at yoctoproject.org
> Subject: Re: [Toaster] DRY RUN [Review Request] 4299 "recipes: View
> detailed information about a recipe"
> 
> Hi,
> 
> I have comments about the content of the patch, as well.
> a). models.py; I am not very fond of having display code in the models,
> because it breaks the MVC separation. The display code should live in
> the templates, e.g.
> 
>     {% if task.outcome == Task.OUTCOME_FAILED %}class=error{% elif %}
> ... {%endif%}
> If this is repeated elsewhere, like in this particular case, you should
> define a new tag in
> ./bitbake/lib/toaster/toastergui/templatetags/projecttags.py that
> returns the code:
> @register.simple_tag
> def task_outcome_highlight(task):
>     if task.outcome == Task.OUTCOME_EXISTING:
>         ret = ''
>   .... etc ...
> and then use it in the template:  {% task_outcome_highlight task %}
> b). html format; please don't use tabs; use 4-space instead of a tab;
> this makes for a nice consistency with the HTML code, and fits the HTML
> code in page better.
> 
> c). recipe.html; please extend "basebuildpage.html" which fills in the
> breadcrumb and all the layout for viewing pages in a build context. see
> configvars.html for an example.
> d). recipes.html; the latest versions of the basetable_top will
> automatically generate correct table header based on the context
> description; please don't include your own table header, but edit the
> page context  to correctly set the table data; see the build view /
> build.html as a how-to guide.
> Hope this helps,
> Alex
> 
> 
> 
> _______________________________________________
> toaster mailing list
> toaster at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/toaster


More information about the toaster mailing list