[extensions-web: 56/75] Don't ACLify the review page.



commit ce17f32b739a436ebb469be8db27b832a8095f4a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Sep 22 01:22:41 2011 -0400

    Don't ACLify the review page.
    
    Anybody should be able to visit it and see the current conversation (which
    isn't there yet). Nobody should just be able to add a comment besides the
    review team and the extension creator. All in the name of transparency.
    
    http://en.wikipedia.org/wiki/Semantic_satiation

 sweettooth/review/templates/review/review.html     |   13 +++----------
 .../review/templates/review/review_reviewer.html   |   14 ++++++++++++++
 sweettooth/review/views.py                         |   15 ++++++---------
 3 files changed, 23 insertions(+), 19 deletions(-)
---
diff --git a/sweettooth/review/templates/review/review.html b/sweettooth/review/templates/review/review.html
index 4754313..0190cc2 100644
--- a/sweettooth/review/templates/review/review.html
+++ b/sweettooth/review/templates/review/review.html
@@ -41,16 +41,9 @@
   {% include "review/review_table.html" with reviews=previous_versions empty="There were no previous reviews of this extension." %}
 </div>
 
-<h2 class="expanded"> Review </h2>
-<div id="review">
-  <form id="review_form" action="{% url review-submit pk=version.pk %}" method="POST">
-    {% csrf_token %}
-    <textarea id="comments" name="comments"></textarea>
-    <input type="radio" value="Accept" name="newstatus" id="accept"> <label for="accept">Accept</label>
-    <input type="radio" value="Reject" name="newstatus" id="reject"> <label for="reject">Reject</label>
-    <input type="submit" value="Review">
-  </form>
-</div>
+{% block extra %}
+{% endblock %}
+
 {% endwith %}
 {% endblock %}
 
diff --git a/sweettooth/review/templates/review/review_reviewer.html b/sweettooth/review/templates/review/review_reviewer.html
new file mode 100644
index 0000000..8eca2d4
--- /dev/null
+++ b/sweettooth/review/templates/review/review_reviewer.html
@@ -0,0 +1,14 @@
+{% extends "review/review.html" %}
+
+{% block extra %}
+<h2 class="expanded"> Review </h2>
+<div id="review">
+  <form id="review_form" action="{% url review-submit pk=version.pk %}" method="POST">
+    {% csrf_token %}
+    <textarea id="comments" name="comments"></textarea>
+    <input type="radio" value="Accept" name="newstatus" id="accept"> <label for="accept">Accept</label>
+    <input type="radio" value="Reject" name="newstatus" id="reject"> <label for="reject">Reject</label>
+    <input type="submit" value="Review">
+  </form>
+</div>
+{% endblock %}
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 7d2582d..6dc79ef 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -99,17 +99,8 @@ class SubmitReviewView(SingleObjectMixin, View):
 
 class ReviewVersionView(DetailView):
     model = models.ExtensionVersion
-    template_name = "review/review.html"
     context_object_name = "version"
 
-    def get(self, request, *args, **kwargs):
-        self.object = self.get_object()
-
-        if not request.user.has_perm("review.can-review-extensions"):
-            return HttpResponseForbidden()
-
-        return super(ReviewVersionView, self).get(request, *args, **kwargs)
-
     def get_context_data(self, **kwargs):
         context = super(ReviewVersionView, self).get_context_data(**kwargs)
         # Reviews on previous versions of the same extension.
@@ -122,6 +113,12 @@ class ReviewVersionView(DetailView):
                             previous_reviews=previous_reviews))
         return context
 
+    @property
+    def template_name(self):
+        if self.request.user.has_perm("review.can-review-extensions"):
+            return "review/review_reviewer.html"
+        return "review/review.html"
+
 class ReviewListView(ListView):
     queryset=models.ExtensionVersion.objects.filter(status=models.STATUS_LOCKED)
     context_object_name="versions"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]