mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 12:01:14 +00:00
Fixes syntax problem on http raises
This commit is contained in:
parent
84443c7f81
commit
e6ae500569
8 changed files with 10 additions and 11 deletions
|
@ -228,7 +228,7 @@ class ExpiryWidget(widgets.Select):
|
||||||
elif selected_string == "forever":
|
elif selected_string == "forever":
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return selected_string # "This will raise
|
return selected_string # This will raise
|
||||||
|
|
||||||
return timezone.now() + interval
|
return timezone.now() + interval
|
||||||
|
|
||||||
|
|
|
@ -193,8 +193,7 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
||||||
# first, the standard raise
|
# first, the standard raise
|
||||||
super().raise_not_editable(viewer)
|
super().raise_not_editable(viewer)
|
||||||
if isinstance(self, (GeneratedNote, ReviewRating)):
|
if isinstance(self, (GeneratedNote, ReviewRating)):
|
||||||
raise PermissionDenied
|
raise PermissionDenied()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GeneratedNote(Status):
|
class GeneratedNote(Status):
|
||||||
|
|
|
@ -276,7 +276,7 @@ urlpatterns = [
|
||||||
# User books
|
# User books
|
||||||
re_path(rf"{USER_PATH}/books/?$", views.Shelf.as_view(), name="user-shelves"),
|
re_path(rf"{USER_PATH}/books/?$", views.Shelf.as_view(), name="user-shelves"),
|
||||||
re_path(
|
re_path(
|
||||||
rf"^{USER_PATH}/(helf|books)/(?P<shelf_identifier>[\w-]+)(.json)?/?$",
|
rf"^{USER_PATH}/(shelf|books)/(?P<shelf_identifier>[\w-]+)(.json)?/?$",
|
||||||
views.Shelf.as_view(),
|
views.Shelf.as_view(),
|
||||||
name="shelf",
|
name="shelf",
|
||||||
),
|
),
|
||||||
|
|
|
@ -105,7 +105,7 @@ def moderator_delete_user(request, user_id):
|
||||||
|
|
||||||
# we can't delete users on other instances
|
# we can't delete users on other instances
|
||||||
if not user.local:
|
if not user.local:
|
||||||
raise PermissionDenied
|
raise PermissionDenied()
|
||||||
|
|
||||||
form = forms.DeleteUserForm(request.POST, instance=user)
|
form = forms.DeleteUserForm(request.POST, instance=user)
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Book(View):
|
||||||
)
|
)
|
||||||
|
|
||||||
if not book or not book.parent_work:
|
if not book or not book.parent_work:
|
||||||
raise Http404
|
raise Http404()
|
||||||
|
|
||||||
# all reviews for all editions of the book
|
# all reviews for all editions of the book
|
||||||
reviews = privacy_filter(
|
reviews = privacy_filter(
|
||||||
|
|
|
@ -80,7 +80,7 @@ class ImportStatus(View):
|
||||||
"""status of an import job"""
|
"""status of an import job"""
|
||||||
job = get_object_or_404(models.ImportJob, id=job_id)
|
job = get_object_or_404(models.ImportJob, id=job_id)
|
||||||
if job.user != request.user:
|
if job.user != request.user:
|
||||||
raise PermissionDenied
|
raise PermissionDenied()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
task = app.AsyncResult(job.task_id)
|
task = app.AsyncResult(job.task_id)
|
||||||
|
|
|
@ -54,9 +54,9 @@ class PasswordReset(View):
|
||||||
try:
|
try:
|
||||||
reset_code = models.PasswordReset.objects.get(code=code)
|
reset_code = models.PasswordReset.objects.get(code=code)
|
||||||
if not reset_code.valid():
|
if not reset_code.valid():
|
||||||
raise PermissionDenied
|
raise PermissionDenied()
|
||||||
except models.PasswordReset.DoesNotExist:
|
except models.PasswordReset.DoesNotExist:
|
||||||
raise PermissionDenied
|
raise PermissionDenied()
|
||||||
|
|
||||||
return TemplateResponse(request, "password_reset.html", {"code": code})
|
return TemplateResponse(request, "password_reset.html", {"code": code})
|
||||||
|
|
||||||
|
|
|
@ -29,11 +29,11 @@ class Register(View):
|
||||||
invite_code = request.POST.get("invite_code")
|
invite_code = request.POST.get("invite_code")
|
||||||
|
|
||||||
if not invite_code:
|
if not invite_code:
|
||||||
raise PermissionDenied
|
raise PermissionDenied()
|
||||||
|
|
||||||
invite = get_object_or_404(models.SiteInvite, code=invite_code)
|
invite = get_object_or_404(models.SiteInvite, code=invite_code)
|
||||||
if not invite.valid():
|
if not invite.valid():
|
||||||
raise PermissionDenied
|
raise PermissionDenied()
|
||||||
else:
|
else:
|
||||||
invite = None
|
invite = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue