Commits

David Wolever committed 033d8eb

Renaming X_queue to queue_X

Comments (0)

Files changed (4)

queue/templates/queue/queue_show.html

+<h1>Showing queue <tt>{{ queue_name }}</tt></h1>
+<ul>
+  {% for url_ in urls %}
+  <li><a href="{{ url_.url }}">{{ url_.title }}</a>
+      (enqueued: {{ url_.enqueued|timesince }})</li>
+  {% endfor %}
+</ul>

queue/templates/queue/show_queue.html

-<h1>Showing queue <tt>{{ queue_name }}</tt></h1>
-<ul>
-  {% for url_ in urls %}
-  <li><a href="{{ url_.url }}">{{ url_.title }}</a>
-      (enqueued: {{ url_.enqueued|timesince }})</li>
-  {% endfor %}
-</ul>
 from django.conf.urls.defaults import *
 
-from views import show_queue, pop_queue
+from views import queue_show, queue_pop
 
 matchers = {
     'queue_name': '[^/]+',
 }
 
 urlpatterns = patterns('',
-    url(r'^(%(queue_name)s)/$' % matchers, show_queue),
-    url(r'^(%(queue_name)s)/pop$' % matchers, pop_queue),
+    url(r'^(%(queue_name)s)/$' % matchers, queue_show),
+    url(r'^(%(queue_name)s)/pop$' % matchers, queue_pop),
 )
 
 from models import QueuedUrl
 
-def assert_method(expected_method):
+def assert_method(*expected_methods):
     def assert_method_helper(decorated, request, *args, **kwargs):
-        if request.method != expected_method:
-            return HttpResponseNotAllowed('%r expected, %r got' %
-                                          ( expected_method,
-                                            request.method ))
+        if request.method not in expected_methods:
+            return HttpResponseNotAllowed('%s: Method not expected' %
+                                          request.method )
         return decorated(request, *args, **kwargs)
 
     def decorate(function):
     return decorate
 
 @assert_method("GET")
-def show_queue(request, queue_name):
+def queue_show(request, queue_name):
     data = {
         'urls': QueuedUrl.objects_in_queue(queue_name),
         'queue_name': queue_name,
     }
 
-    return render_to_response('queue/show_queue.html', data)
+    return render_to_response('queue/queue_show.html', data)
 
 @assert_method("POST")
-def pop_queue(request, queue_name):
+def queue_pop(request, queue_name):
     next_url = QueuedUrl.next_in(queue_name)
 
     if next_url is None: