summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-11-21 09:55:03 -0300
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-11-21 09:55:03 -0300
commit0b8f03823cd007aa45df051160a3b2417d8d07bc (patch)
tree8ef2ef3daef8279d1c8c8351b0d842e7201457d2
parent7122b65c2aba1e3831680503994de9b172e27125 (diff)
parent428249c34aecb67c59bbe87bfd1721b767dacfdb (diff)
downloadaskbot-0b8f03823cd007aa45df051160a3b2417d8d07bc.tar.gz
askbot-0b8f03823cd007aa45df051160a3b2417d8d07bc.tar.bz2
askbot-0b8f03823cd007aa45df051160a3b2417d8d07bc.zip
Merge branch 'master' of github.com:ASKBOT/askbot-devel
-rw-r--r--askbot/views/readers.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/askbot/views/readers.py b/askbot/views/readers.py
index f352a166..ec3ca57b 100644
--- a/askbot/views/readers.py
+++ b/askbot/views/readers.py
@@ -377,6 +377,7 @@ def question(request, id):#refactor - long subroutine. display question body, an
"""view that displays body of the question and
all answers to it
"""
+ #process url parameters
#todo: fix inheritance of sort method from questions
default_sort_method = request.session.get('questions_sort_method', 'votes')
form = ShowQuestionForm(request.GET, default_sort_method)
@@ -395,7 +396,14 @@ def question(request, id):#refactor - long subroutine. display question body, an
#redirect also happens if id of the object's origin post != requested id
show_post = None #used for permalinks
if show_comment is not None:
- #comments
+ #if url calls for display of a specific comment,
+ #check that comment exists, that it belongs to
+ #the current question
+ #if it is an answer comment and the answer is hidden -
+ #redirect to the default view of the question
+ #if the question is hidden - redirect to the main page
+ #in addition - if url points to a comment and the comment
+ #is for the answer - we need the answer object
try:
show_comment = models.Comment.objects.get(id = show_comment)
if str(show_comment.get_origin_post().id) != id:
@@ -418,7 +426,10 @@ def question(request, id):#refactor - long subroutine. display question body, an
return HttpResponseRedirect(reverse('index'))
elif show_answer is not None:
- #answers
+ #if the url calls to view a particular answer to
+ #question - we must check whether the question exists
+ #whether answer is actually corresponding to the current question
+ #and that the visitor is allowed to see it
try:
show_post = get_object_or_404(models.Answer, id = show_answer)
if str(show_post.question.id) != id: