[yocto] [patchwork][PATCH] series.py: return bundle objects only when authenticated
Jose Lamego
jose.a.lamego at linux.intel.com
Thu Mar 9 07:42:49 PST 2017
If a non-authenticated user tries to get a series view from
patchwork web UI, a 500 error message is displayed caused by
the database access attempted when filtering the bundle objects.
This change allows not-logged users to acces series view by
returning an empty bundle variable, instead of trying to
access the database.
Signed-off-by: Jose Lamego <jose.a.lamego at linux.intel.com>
---
patchwork/views/series.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/patchwork/views/series.py b/patchwork/views/series.py
index cb3b721..765d2e5 100644
--- a/patchwork/views/series.py
+++ b/patchwork/views/series.py
@@ -48,7 +48,10 @@ class SeriesView(View):
revisions = get_list_or_404(SeriesRevision, series=series)
patchform = PatchForm(project=series.project)
createbundleform = CreateBundleForm()
- bundles = Bundle.objects.filter(owner=request.user)
+ if request.user.is_authenticated():
+ bundles = Bundle.objects.filter(owner=request.user)
+ else:
+ bundles=""
for revision in revisions:
revision.patch_list = revision.ordered_patches().\
select_related('state', 'submitter')
--
2.7.4
More information about the yocto
mailing list