series.py: return bundle objects only when authenticated
PATCH 1/1 series.py: return bundle objects only when authenticated
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 <[email protected]>
--- patchwork/views/series.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
patchwork/views/series.py +4 -1
@@ -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')
Signature · 1 line
2.7.4