Fix crash when guests view package page

This commit is contained in:
rubenwardy 2020-07-09 05:34:55 +01:00
parent 849b814034
commit db80c441ec

@ -158,7 +158,7 @@ def view(package):
elif not current_user.rank.atLeast(UserRank.EDITOR) and not current_user == package.author: elif not current_user.rank.atLeast(UserRank.EDITOR) and not current_user == package.author:
threads = threads.filter(or_(Thread.private == False, Thread.author == current_user)) threads = threads.filter(or_(Thread.private == False, Thread.author == current_user))
has_review = PackageReview.query.filter_by(package=package, author=current_user).count() > 0 has_review = current_user.is_authenticated and PackageReview.query.filter_by(package=package, author=current_user).count() > 0
return render_template("packages/view.html", \ return render_template("packages/view.html", \
package=package, releases=releases, requests=requests, \ package=package, releases=releases, requests=requests, \