From 03e1896aff7184d310a5f5a2a6513fa364bb3bf0 Mon Sep 17 00:00:00 2001 From: firm1 Date: Thu, 21 Aug 2014 11:56:40 +0200 Subject: [PATCH] =?UTF-8?q?corrige=20les=20erreurs=20dans=20les=20param?= =?UTF-8?q?=C3=A8tres=20GET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zds/forum/views.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/zds/forum/views.py b/zds/forum/views.py index 0db52095d7..b95b6ed415 100644 --- a/zds/forum/views.py +++ b/zds/forum/views.py @@ -153,7 +153,7 @@ def topic(request, topic_pk, topic_slug): categories = Category.objects.all() try: page_nbr = int(request.GET["page"]) - except KeyError: + except: page_nbr = 1 try: posts = paginator.page(page_nbr) @@ -233,7 +233,7 @@ def new(request): try: forum_pk = request.GET["forum"] - except KeyError: + except: raise Http404 forum = get_object_or_404(Forum, pk=forum_pk) if not forum.can_read(request.user): @@ -344,7 +344,7 @@ def move_topic(request): raise PermissionDenied try: topic_pk = request.GET["sujet"] - except KeyError: + except: raise Http404 forum = get_object_or_404(Forum, pk=request.POST["forum"]) if not forum.can_read(request.user): @@ -374,11 +374,11 @@ def edit(request): try: topic_pk = request.POST["topic"] - except KeyError: + except: raise Http404 try: page = int(request.POST["page"]) - except KeyError: + except: page = 1 data = request.POST resp = {} @@ -409,7 +409,7 @@ def edit(request): if "move" in data: try: forum_pk = int(request.POST["move_target"]) - except KeyError: + except: raise Http404 forum = get_object_or_404(Forum, pk=forum_pk) g_topic.forum = forum @@ -432,7 +432,7 @@ def answer(request): try: topic_pk = request.GET["sujet"] - except KeyError: + except: raise Http404 # Retrieve current topic. @@ -589,7 +589,7 @@ def edit_post(request): try: post_pk = request.GET["message"] - except KeyError: + except: raise Http404 post = get_object_or_404(Post, pk=post_pk) if not post.topic.forum.can_read(request.user): @@ -715,7 +715,7 @@ def useful_post(request): try: post_pk = request.GET["message"] - except KeyError: + except: raise Http404 post = get_object_or_404(Post, pk=post_pk) @@ -741,7 +741,7 @@ def unread_post(request): try: post_pk = request.GET["message"] - except KeyError: + except: raise Http404 post = get_object_or_404(Post, pk=post_pk) @@ -775,7 +775,7 @@ def like_post(request): try: post_pk = request.GET["message"] - except KeyError: + except: raise Http404 resp = {} post = get_object_or_404(Post, pk=post_pk) @@ -822,7 +822,7 @@ def dislike_post(request): try: post_pk = request.GET["message"] - except KeyError: + except: raise Http404 resp = {} post = get_object_or_404(Post, pk=post_pk)