from django.template.loader import render_to_string
from debug_toolbar.panels import DebugPanel

class RequestVarsDebugPanel(DebugPanel):
    """
    A panel to display request variables (POST/GET, session, cookies).
    """
    name = 'RequestVars'
    has_content = True

    def nav_title(self):
        return 'Request Vars'
    
    def title(self):
        return 'Request Vars'
    
    def url(self):
        return ''

    def process_request(self, request):
        self.request = request

    def content(self):
        context = {
            'get': [(k, self.request.GET.getlist(k)) for k in self.request.GET.iterkeys()],
            'post': [(k, self.request.POST.getlist(k)) for k in self.request.POST.iterkeys()],
            'session': [(k, self.request.session.get(k)) for k in self.request.session.iterkeys()],
            'cookies': [(k, self.request.COOKIES.get(k)) for k in self.request.COOKIES.iterkeys()],
        }
        return render_to_string('debug_toolbar/panels/request_vars.html', context)
@@ -736,23 +736,23 @@
        '
-session
+cookies
 ': %5B(k, 
@@ -764,23 +764,23 @@
 request.
-session
+COOKIES
 .get(k))
@@ -802,23 +802,23 @@
 request.
-session
+COOKIES
 .iterkey
@@ -827,38 +827,103 @@
 )%5D,%0A        
+%7D%0A
     
-'cookies':
+    if hasattr(self.request, 'session'):%0A            context%5B'session'%5D =
  %5B(k, self.r
@@ -921,39 +921,39 @@
 k, self.request.
-COOKIES
+session
 .get(k)) for k i
@@ -959,39 +959,39 @@
 in self.request.
-COOKIES
+session
 .iterkeys()%5D,%0A  
@@ -984,33 +984,24 @@
 terkeys()%5D,%0A
-        %7D
 %0A        ret
@@ -1071,8 +1071,9 @@
 context)
+%0A

Allow request vars to work even with disabled session middleware.