Commit 533e0726 by Ned Batchelder Committed by Anurag Ramdasan

A debug view for seeing the URL params

parent 412e6d34
......@@ -3,15 +3,15 @@
import pprint
import traceback
from django.http import Http404
from django.http import Http404, HttpResponse
from django.contrib.auth.decorators import login_required
from django.utils.html import escape
from django_future.csrf import ensure_csrf_cookie
from edxmako.shortcuts import render_to_response
from codejail.safe_exec import safe_exec
from util.json_request import JsonResponse
@login_required
@ensure_csrf_cookie
......@@ -36,9 +36,10 @@ def run_python(request):
@login_required
def show_parameters(request):
"""A page that shows what GET parameters were on the URL."""
params = {
'get': dict(request.GET),
'post': dict(request.POST),
}
return JsonResponse(params)
"""A page that shows what parameters were on the URL and post."""
html = []
for name, value in sorted(request.GET.items()):
html.append(escape("GET {}: {!r}".format(name, value)))
for name, value in sorted(request.POST.items()):
html.append(escape("POST {}: {!r}".format(name, value)))
return HttpResponse("\n".join("<p>{}</p>".format(h) for h in html))
......@@ -478,11 +478,11 @@ urlpatterns += (
if settings.FEATURES.get('ENABLE_DEBUG_RUN_PYTHON'):
urlpatterns += (
url(r'^debug/run_python', 'debug.views.run_python'),
url(r'^debug/run_python$', 'debug.views.run_python'),
)
urlpatterns += (
url(r'^debug/show_parameters', 'debug.views.show_parameters'),
url(r'^debug/show_parameters$', 'debug.views.show_parameters'),
)
# Crowdsourced hinting instructor manager.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment