Skip to content

Fixes #367 issue. #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions debug_toolbar/panels/request_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def process_response(self, request, response):
try:
match = resolve(self.request.path)
func, args, kwargs = match
# Converting the objects to its string representation
args = tuple([str(arg) for arg in args])
kwargs = dict([(key, str(arg)) for (key, arg) in kwargs.iteritems()])
view_info['view_func'] = get_name_from_obj(func)
view_info['view_args'] = args
view_info['view_kwargs'] = kwargs
Expand Down
4 changes: 4 additions & 0 deletions tests/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django import forms

class TestForm(forms.Form):
pass
5 changes: 4 additions & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from debug_toolbar.utils import get_name_from_obj
from debug_toolbar.utils.tracking import pre_dispatch, post_dispatch, callbacks

from forms import TestForm

rf = RequestFactory()


Expand Down Expand Up @@ -171,7 +173,8 @@ def test_url_resolving_named(self):
def test_url_resolving_mixed(self):
stats = self._resolve_stats('/resolving3/a/')
self.assertEquals(stats['view_args'], ('a',))
self.assertEquals(stats['view_kwargs'], {'arg2': 'default'})
self.assertEquals(stats['view_kwargs'], {
'arg2': 'default', 'arg3': '1', 'arg4': str(TestForm) })

def test_url_resolving_bad(self):
stats = self._resolve_stats('/non-existing-url/')
Expand Down
4 changes: 3 additions & 1 deletion tests/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
this into the urlconf for the request.
"""
from django.contrib import admin
from forms import TestForm
try:
from django.conf.urls import patterns, url
except ImportError: # django < 1.4
Expand All @@ -16,6 +17,7 @@
# This pattern should be last to ensure tests still work
url(r'^resolving1/(.+)/(.+)/$', 'tests.views.resolving_view', name='positional-resolving'),
url(r'^resolving2/(?P<arg1>.+)/(?P<arg2>.+)/$', 'tests.views.resolving_view'),
url(r'^resolving3/(.+)/$', 'tests.views.resolving_view', { 'arg2' : 'default' }),
url(r'^resolving3/(.+)/$', 'tests.views.resolving_view', {
'arg2' : 'default', 'arg3': 1, 'arg4': TestForm }),
url(r'^execute_sql/$', 'tests.views.execute_sql'),
)