[extensions-web] errorreports: Switch to using explicit URL view redirecting



commit c3ca508619f9768b541c9154eb8a2ded3345d2b6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jun 21 17:42:11 2012 -0400

    errorreports: Switch to using explicit URL view redirecting

 sweettooth/errorreports/tests.py                   |    3 ++-
 sweettooth/errorreports/urls.py                    |    7 ++-----
 sweettooth/errorreports/views.py                   |    9 +++------
 .../extensions/templates/extensions/comments.html  |    2 +-
 4 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/sweettooth/errorreports/tests.py b/sweettooth/errorreports/tests.py
index f4b31a8..9609462 100644
--- a/sweettooth/errorreports/tests.py
+++ b/sweettooth/errorreports/tests.py
@@ -31,7 +31,8 @@ class SubmitErrorReportTestCase(TestCase):
     def test_email_sent(self):
         comment = "YOUR EXTENSION SUCKS IT BROKE"
 
-        self.client.post(reverse('errorreports-report', kwargs=dict(pk=self.extension.pk)),
+        self.client.post(reverse('errorreports.views.report_error',
+                                 kwargs=dict(pk=extension.pk)),
                          dict(comment=comment), follow=True)
 
         self.assertEqual(len(mail.outbox), 1)
diff --git a/sweettooth/errorreports/urls.py b/sweettooth/errorreports/urls.py
index 6c73dcb..990b5a7 100644
--- a/sweettooth/errorreports/urls.py
+++ b/sweettooth/errorreports/urls.py
@@ -4,9 +4,6 @@ from django.conf.urls.defaults import patterns, url
 from errorreports import views
 
 urlpatterns = patterns('',
-    url(r'^report/(?P<pk>\d+)',
-        views.report_error_view, name='errorreports-report'),
-
-    url(r'^view/(?P<pk>\d+)',
-        views.view_error_report_view, name='errorreports-view'),
+    url(r'^report/(?P<pk>\d+)', views.report_error),
+    url(r'^view/(?P<pk>\d+)', views.view_error_report),
 )
diff --git a/sweettooth/errorreports/views.py b/sweettooth/errorreports/views.py
index 07536a2..d2a17a7 100644
--- a/sweettooth/errorreports/views.py
+++ b/sweettooth/errorreports/views.py
@@ -16,7 +16,7 @@ from decorators import model_view
 from utils import render
 
 @model_view(Extension.objects.visible())
-def report_error_view(request, extension):
+def report_error(request, extension):
     if request.method == 'POST':
         form = ErrorReportForm(data=request.POST)
 
@@ -33,7 +33,6 @@ def report_error_view(request, extension):
             return redirect('extensions-detail',
                             pk=extension.pk,
                             slug=extension.slug)
-
     else:
         form = ErrorReportForm()
 
@@ -42,13 +41,11 @@ def report_error_view(request, extension):
     return render(request, 'errorreports/report.html', context)
 
 @model_view(ErrorReport)
-def view_error_report_view(request, obj):
+def view_error_report(request, obj):
     return render(request, 'errorreports/view.html', dict(report=obj))
 
-
 def send_email_on_error_reported(sender, request, extension, report, **kwargs):
-
-    url = request.build_absolute_uri(reverse('errorreports-view',
+    url = request.build_absolute_uri(reverse('errorreports.views.view_error_report',
                                              kwargs=dict(pk=report.pk)))
 
     data = dict(extension=extension,
diff --git a/sweettooth/extensions/templates/extensions/comments.html b/sweettooth/extensions/templates/extensions/comments.html
index 2a6e559..9e90e1b 100644
--- a/sweettooth/extensions/templates/extensions/comments.html
+++ b/sweettooth/extensions/templates/extensions/comments.html
@@ -32,7 +32,7 @@
     Leave a...
     <a href="javascript:void 0" id="leave_comment">Comment</a>
     <a href="javascript:void 0" id="leave_rating">Rating</a>
-    <a href="{% url errorreports-report pk=extension.pk %}">Bug report</a>
+    <a href="{% url errorreports.views.report_error pk=extension.pk %}">Bug report</a>
   </div>
   <div id="rating_form">
     {% render_comment_form for extension %}



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