Commit 14763c37 by Victor Shnayder

add a debug_request view that prints the request.

parent a5483c16
import datetime import datetime
import json import json
import pprint
import sys import sys
from django.conf import settings from django.conf import settings
...@@ -91,3 +92,7 @@ def accepts(request, media_type): ...@@ -91,3 +92,7 @@ def accepts(request, media_type):
"""Return whether this request has an Accept header that matches type""" """Return whether this request has an Accept header that matches type"""
accept = parse_accept_header(request.META.get("HTTP_ACCEPT", "")) accept = parse_accept_header(request.META.get("HTTP_ACCEPT", ""))
return media_type in [t for (t, p, q) in accept] return media_type in [t for (t, p, q) in accept]
def debug_request(request):
"""Return a pretty printed version of the request"""
return HttpResponse("<html><pre>{0}</pre></html>".format(pprint.pformat(request)))
...@@ -15,6 +15,10 @@ urlpatterns = ('', ...@@ -15,6 +15,10 @@ urlpatterns = ('',
url(r'^admin_dashboard$', 'dashboard.views.dashboard'), url(r'^admin_dashboard$', 'dashboard.views.dashboard'),
# Adding to allow debugging issues when prod is mysteriously different from staging
# (specifically missing get parameters in certain cases)
url(r'^debug_request$', 'util.views.debug_request'),
url(r'^change_email$', 'student.views.change_email_request'), url(r'^change_email$', 'student.views.change_email_request'),
url(r'^email_confirm/(?P<key>[^/]*)$', 'student.views.confirm_email_change'), url(r'^email_confirm/(?P<key>[^/]*)$', 'student.views.confirm_email_change'),
url(r'^change_name$', 'student.views.change_name_request'), url(r'^change_name$', 'student.views.change_name_request'),
......
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