* [review-request][PATCH 1/3] bitbake: toastergui: Fix toastertable table header reference
@ 2015-08-06 14:25 Michael Wood
2015-08-06 14:25 ` [review-request][PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py Michael Wood
2015-08-06 14:25 ` [review-request][PATCH 3/3] bitbake: toastermain: Add a longer default database timeout Michael Wood
0 siblings, 2 replies; 4+ messages in thread
From: Michael Wood @ 2015-08-06 14:25 UTC (permalink / raw)
To: toaster
A header id was mistakenly added to the table template which was not
also added to the simple version of the toaster template. We don't need
this id so remove it.
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
---
bitbake/lib/toaster/toastergui/static/js/table.js | 2 +-
bitbake/lib/toaster/toastergui/templates/toastertable.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js b/bitbake/lib/toaster/toastergui/static/js/table.js
index d06a3f5..f18034d 100644
--- a/bitbake/lib/toaster/toastergui/static/js/table.js
+++ b/bitbake/lib/toaster/toastergui/static/js/table.js
@@ -198,7 +198,7 @@ function tableInit(ctx){
if (tableChromeDone === true)
return;
- var tableHeadRow = table.find("thead#tableheader");
+ var tableHeadRow = table.find("thead");
var editColMenu = $("#table-chrome-"+ctx.tableName).find(".editcol");
tableHeadRow.html("");
diff --git a/bitbake/lib/toaster/toastergui/templates/toastertable.html b/bitbake/lib/toaster/toastergui/templates/toastertable.html
index 0473116..9ef4c6f 100644
--- a/bitbake/lib/toaster/toastergui/templates/toastertable.html
+++ b/bitbake/lib/toaster/toastergui/templates/toastertable.html
@@ -78,7 +78,7 @@
<!-- The actual table -->
<table class="table table-bordered table-hover tablesorter" id="{{table_name}}">
- <thead id="tableheader">
+ <thead>
<tr><th></th></tr>
</thead>
<tbody></tbody>
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [review-request][PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py
2015-08-06 14:25 [review-request][PATCH 1/3] bitbake: toastergui: Fix toastertable table header reference Michael Wood
@ 2015-08-06 14:25 ` Michael Wood
2015-08-06 14:25 ` [review-request][PATCH 3/3] bitbake: toastermain: Add a longer default database timeout Michael Wood
1 sibling, 0 replies; 4+ messages in thread
From: Michael Wood @ 2015-08-06 14:25 UTC (permalink / raw)
To: toaster
The layerdetails view definition was moved to tables though it isn't
a table. We have a mechanism for the JSON response for this page so use
this instead of a custom class.
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
---
bitbake/lib/toaster/toastergui/tables.py | 24 +-----------------------
bitbake/lib/toaster/toastergui/urls.py | 3 +--
bitbake/lib/toaster/toastergui/views.py | 15 +++++++++++++++
bitbake/lib/toaster/toastergui/widgets.py | 26 --------------------------
4 files changed, 17 insertions(+), 51 deletions(-)
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index 8d5166be..8770df5 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -19,7 +19,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-from toastergui.widgets import ToasterTable, ToasterTemplateView
+from toastergui.widgets import ToasterTable
from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project
from django.db.models import Q, Max
from django.conf.urls import url
@@ -202,28 +202,6 @@ class LayersTable(ToasterTable):
computation = lambda x: x.layer.name)
-
-
-class LayerDetails(ToasterTemplateView):
- def get_context_data(self, **kwargs):
- context = super(LayerDetails, self).get_context_data(**kwargs)
- from toastergui.views import _lv_to_dict
-
- context['project'] = Project.objects.get(pk=kwargs['pid'])
- context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid'])
- context['layerdict'] = _lv_to_dict(context['project'], context['layerversion'])
- context['layerdeps'] = {"list": [
- [ {"id": y.id,
- "name": y.layer.name,
- "layerdetailurl": reverse('layerdetails', args=(kwargs['pid'], y.id)),
- } for y in x.depends_on.get_equivalents_wpriority(context['project'])][0] for x in context['layerversion'].dependencies.all()]}
- context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project']))
-
- self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps']
-
- return context
-
-
class MachinesTable(ToasterTable, ProjectFiltersMixin):
"""Table of Machines in Toaster"""
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index beb4303..6a2c586 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -109,8 +109,7 @@ urlpatterns = patterns('toastergui.views',
name="projectlayers"),
url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)$',
- tables.LayerDetails.as_view(template_name='layerdetails.html'),
- name='layerdetails'),
+ 'layerdetails', name='layerdetails'),
url(r'^project/(?P<pid>\d+)/layer/(?P<layerid>\d+)/recipes/$',
tables.LayerRecipesTable.as_view(template_name="generic-toastertable-page.html"),
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index b43a01e..21997d6 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2528,6 +2528,21 @@ if True:
}
return render(request, template, context)
+ @_template_renderer('layerdetails.html')
+ def layerdetails(request, pid, layerid):
+ project = Project.objects.get(pk=pid)
+ layer_version = Layer_Version.objects.get(pk=layerid)
+
+ context = { 'project' : project,
+ 'layerversion' : layer_version,
+ 'layerdeps' : { "list": [
+ [{"id": y.id, "name": y.layer.name} for y in x.depends_on.get_equivalents_wpriority(project)][0] for x in layer_version.dependencies.all()]},
+ 'projectlayers': map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project))
+ }
+
+ return context
+
+
def get_project_configvars_context():
# Vars managed outside of this view
vars_managed = {
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py
index 0885402..1f81297 100644
--- a/bitbake/lib/toaster/toastergui/widgets.py
+++ b/bitbake/lib/toaster/toastergui/widgets.py
@@ -328,29 +328,3 @@ class ToasterTable(TemplateView):
cache.set(cache_name, data, 60*30)
return data
-
-
-class ToasterTemplateView(TemplateView):
- # renders a instance in a template, or returns the context as json
- # the class-equivalent of the _template_renderer decorator for views
-
-
- def get(self, *args, **kwargs):
- if self.request.GET.get('format', None) == 'json':
- from django.core.urlresolvers import reverse
- from django.shortcuts import HttpResponse
- from views import objtojson
- from toastergui.templatetags.projecttags import json as jsonfilter
-
- context = self.get_context_data(**kwargs)
-
- for x in context.keys():
- if x not in self.context_entries:
- del context[x]
-
- context["error"] = "ok"
-
- return HttpResponse(jsonfilter(context, default=objtojson ),
- content_type = "application/json; charset=utf-8")
-
- return super(ToasterTemplateView, self).get(*args, **kwargs)
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [review-request][PATCH 3/3] bitbake: toastermain: Add a longer default database timeout
2015-08-06 14:25 [review-request][PATCH 1/3] bitbake: toastergui: Fix toastertable table header reference Michael Wood
2015-08-06 14:25 ` [review-request][PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py Michael Wood
@ 2015-08-06 14:25 ` Michael Wood
2015-08-06 14:28 ` Michael Wood
1 sibling, 1 reply; 4+ messages in thread
From: Michael Wood @ 2015-08-06 14:25 UTC (permalink / raw)
To: toaster
When using sqlite we sometimes see Database Locked exceptions when we
fire off database calls asynchronously from the UI. We need sqlite to
wait a bit longer for the lock to be released.
n.b In production setup we hopefully wouldn't be using sqlite.
docs.djangoproject.com/en/1.6/ref/databases/#database-is-locked-errors
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
---
bitbake/lib/toaster/toastermain/settings.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index c72a904..b149a5e 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -49,6 +49,12 @@ DATABASES = {
}
}
+# Needed when Using sqlite especially to add a longer timeout for waiting
+# for the database lock to be released
+# https://docs.djangoproject.com/en/1.6/ref/databases/#database-is-locked-errors
+if 'sqlite' in DATABASES['default']['ENGINE']:
+ DATABASES['default']['OPTIONS'] = { 'timeout': 20 }
+
# Reinterpret database settings if we have DATABASE_URL environment variable defined
if 'DATABASE_URL' in os.environ:
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [review-request][PATCH 3/3] bitbake: toastermain: Add a longer default database timeout
2015-08-06 14:25 ` [review-request][PATCH 3/3] bitbake: toastermain: Add a longer default database timeout Michael Wood
@ 2015-08-06 14:28 ` Michael Wood
0 siblings, 0 replies; 4+ messages in thread
From: Michael Wood @ 2015-08-06 14:28 UTC (permalink / raw)
To: toaster@yoctoproject.org
Should have mentioned that this is a v2 series of
https://lists.yoctoproject.org/pipermail/toaster/2015-July/002428.html
https://lists.yoctoproject.org/pipermail/toaster/2015-July/002429.html
https://lists.yoctoproject.org/pipermail/toaster/2015-July/002430.html
Which is now rebased and with the fixes for review items mentioned by Ed
Michael
On 06/08/15 15:25, Michael Wood wrote:
> When using sqlite we sometimes see Database Locked exceptions when we
> fire off database calls asynchronously from the UI. We need sqlite to
> wait a bit longer for the lock to be released.
> n.b In production setup we hopefully wouldn't be using sqlite.
>
> docs.djangoproject.com/en/1.6/ref/databases/#database-is-locked-errors
>
> Signed-off-by: Michael Wood <michael.g.wood@intel.com>
> ---
> bitbake/lib/toaster/toastermain/settings.py | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
> index c72a904..b149a5e 100644
> --- a/bitbake/lib/toaster/toastermain/settings.py
> +++ b/bitbake/lib/toaster/toastermain/settings.py
> @@ -49,6 +49,12 @@ DATABASES = {
> }
> }
>
> +# Needed when Using sqlite especially to add a longer timeout for waiting
> +# for the database lock to be released
> +# https://docs.djangoproject.com/en/1.6/ref/databases/#database-is-locked-errors
> +if 'sqlite' in DATABASES['default']['ENGINE']:
> + DATABASES['default']['OPTIONS'] = { 'timeout': 20 }
> +
> # Reinterpret database settings if we have DATABASE_URL environment variable defined
>
> if 'DATABASE_URL' in os.environ:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-08-06 14:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-06 14:25 [review-request][PATCH 1/3] bitbake: toastergui: Fix toastertable table header reference Michael Wood
2015-08-06 14:25 ` [review-request][PATCH 2/3] bitbake: toastergui: Move layerdetails view definition to the views.py Michael Wood
2015-08-06 14:25 ` [review-request][PATCH 3/3] bitbake: toastermain: Add a longer default database timeout Michael Wood
2015-08-06 14:28 ` Michael Wood
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.