Every repository with this icon (
Every repository with this icon (
| Description: | A configurable set of panels that display various debug information about the current request/response. edit |
-
0 comments Created 14 days ago by kmikedefectxNew Request Vars panel with view arguments raises exception when view kwargs contain object that can't be unicodedverifiedxMy case was passing custom form class to login view. The solution can be the same we've done with context (bypass objects with broken unicode) but with this solution we'll hide some view arguments.
Full traceback:
Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 279, in run
self.result = application(self.environ, self.start_response)File "/opt/local/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 651, in call
return self.application(environ, start_response)File "/opt/local/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 245, in call
response = middleware_method(request, response)File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/debug_toolbar/middleware.py", line 91, in process_response
response.content = replace_insensitive(smart_unicode(response.content), u'</body>', smart_unicode(self.debug_toolbars[request].render_toolbar() + u'</body>'))File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/debug_toolbar/toolbar/loader.py", line 72, in render_toolbar
'BASE_URL': self.request.META.get('SCRIPT_NAME', ''),File "/opt/local/lib/python2.5/site-packages/django/template/loader.py", line 108, in render_to_string
return t.render(context_instance)File "/opt/local/lib/python2.5/site-packages/django/test/utils.py", line 29, in instrumented_test_render
return self.nodelist.render(context)File "/opt/local/lib/python2.5/site-packages/django/template/init.py", line 779, in render
bits.append(self.render_node(node, context))File "/opt/local/lib/python2.5/site-packages/django/template/debug.py", line 71, in render_node
result = node.render(context)File "/opt/local/lib/python2.5/site-packages/django/template/defaulttags.py", line 155, in render
nodelist.append(node.render(context))File "/Users/kmike/dev/tur/smart_tags/templatetags/smart_if.py", line 213, in render
return self.nodelist_true.render(context)File "/opt/local/lib/python2.5/site-packages/django/template/init.py", line 779, in render
bits.append(self.render_node(node, context))File "/opt/local/lib/python2.5/site-packages/django/template/debug.py", line 71, in render_node
result = node.render(context)File "/opt/local/lib/python2.5/site-packages/django/template/debug.py", line 87, in render
output = force_unicode(self.filter_expression.resolve(context))File "/opt/local/lib/python2.5/site-packages/django/template/init.py", line 546, in resolve
obj = self.var.resolve(context)File "/opt/local/lib/python2.5/site-packages/django/template/init.py", line 687, in resolve
value = self._resolve_lookup(context)File "/opt/local/lib/python2.5/site-packages/django/template/init.py", line 722, in _resolve_lookup
current = current()File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/debug_toolbar/panels/request_vars.py", line 40, in content
return render_to_string('debug_toolbar/panels/request_vars.html', context)File "/opt/local/lib/python2.5/site-packages/django/template/loader.py", line 108, in render_to_string
return t.render(context_instance)File "/opt/local/lib/python2.5/site-packages/django/test/utils.py", line 29, in instrumented_test_render
return self.nodelist.render(context)File "/opt/local/lib/python2.5/site-packages/django/template/init.py", line 779, in render
bits.append(self.render_node(node, context))File "/opt/local/lib/python2.5/site-packages/django/template/debug.py", line 81, in render_node
raise wrappedTemplateSyntaxError: Caught an exception while rendering: unbound method unicode() must be called with EmailAuthenticationForm instance as first argument (got nothing instead)
Original Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/django/template/debug.py", line 71, in render_noderesult = node.render(context)File "/opt/local/lib/python2.5/site-packages/django/template/defaulttags.py", line 155, in render
nodelist.append(node.render(context))File "/opt/local/lib/python2.5/site-packages/django/template/debug.py", line 87, in render
output = force_unicode(self.filter_expression.resolve(context))File "/opt/local/lib/python2.5/site-packages/django/utils/encoding.py", line 71, in force_unicode
s = unicode(s)TypeError: unbound method unicode() must be called with EmailAuthenticationForm instance as first argument (got nothing instead)
Comments
-
0 comments Created about 1 month ago by robhudsondefectxBoolean parameters don't survive JSON/urlencode in SQL panel SELECT subpanelverifiedxAfter looking briefly I believe the problem is using force_unicode on each parameter resulting in a parameter of
(True,)turning into("True",), which doesn't get turned back into the raw boolean when trying to re-execute the query resulting in a database error.Comments
-
When INTERCEPT_REDIRECTS enabled, cookies set by app's redirect response will be lost.
By example, in a login view, app set a user_id cookie on a redirect response, but this cookie does not send to browser actually.
(Originally added by: flytwokites on Google Code)
Comments
Here is a patch to address this problem:
From <a href="/robhudson/django-debug-toolbar/commit/9fab69c4c41bd0376c8b5c01430a646698776b6a">9fab69c</a> Mon Sep 17 00:00:00 2001 From: http://github.com/ziz Date: Sun, 22 Nov 2009 15:07:25 -0700 Subject: [PATCH] Set cookies during middleware intercept. It would probably be helpful to compare these cookies to the initial request's cookies and display the differences in the redirect template, since the debug toolbar doesn't otherwise have an opportunity to show them. --- debug_toolbar/middleware.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index 5c10f9f..264515e 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -79,10 +79,12 @@ class DebugToolbarMiddleware(object): if isinstance(response, HttpResponseRedirect): redirect_to = response.get('Location', None) if redirect_to: + cookies = response.cookies response = render_to_response( 'debug_toolbar/redirect.html', {'redirect_to': redirect_to} ) + response.cookies = cookies if response.status_code == 200: for panel in self.debug_toolbars[request].panels: panel.process_response(request, response) -- 1.6.4.1It does not display the cookies set in the redirect page, but at least it addresses the functional problem.
-
3 comments Created 3 months ago by delfickurlpatterns multply when toolbar is enableddefectxWhen the debug toolbar is enabled, then the urlpatterns are multiplied everytime a request is made.
I tested this by setting debug to True and entering an address that I don't have a pattern for. Every time I refresh the page, the urlpatterns increases.
If I do the same but with the debug toolbar disabled, then the urlpatterns does not increase.
to demonstrate visually:
what it should lok like : http://delfick.test.googlepages.com/urlpatterns.png
what it looks like after a refresh : http://delfick.test.googlepages.com/urlpatterns2.png
(and for every refresh it increases)...
Comments
Which version are you using? That was a bug I thought we fixed some time ago.
I just updated to the latest git and it's still there.....
I decided to look into this further and found a fix.... I'm not sure how to add files to these comments, but you can find a patch of my fix here http://delfick.test.googlepages.com/debug_toolbar_urls.patch
-
1 comment Created about 1 month ago by simonwdefectxAvoid issues if user is running different jQuery versionverifiedxdjango-debug-toolbar failed for me on a site running jQuery 1.3.2 - I think it's because of library version incompatibilities.
Armin describes a way of ensuring the version of jQuery that ships with the toolbar is the one used by its scripts, without interfering with the jQuery version in use on the site, here:
Comments
Yes, Armin submitted a patch on his branch:
http://github.com/mitsuhiko/django-debug-toolbarIt did not work for me, however. I need to spend more time with it to determine why.
It's a bit of a challenge since it has to work in many cases...
- If there's not jQuery
- If there is already a jQuery
- If there are other libraries (mootools, prototype, etc)
- If there's not jQuery
-
See http://www.djangosnippets.org/snippets/605/. My thinking is this will trigger a new request to profile that specific URL and show the results.
Comments
binarydud has started working on this here:
http://github.com/binarydud/django-debug-toolbar/tree/profile
I've got a fork of binarydud's profile panel with a couple of improvements. All of the implementations I've seen naively call the view twice because they expect that returning a response from within process_view will short circuit processing as it does for real middleware. The debug toolbar actually discards anything returned from process_view so this doesn't happen. I've changed this in my fork to return the last response returned (if any) from the panels. Unfortunately, panel order is now theoretically more important, but profiling works much better. Also, I've added checks to disable profiling if the response is actually generated from another middleware, like flatpages, because process_view is never called for these requests.
-
0 comments Created 7 months ago by robhudsonRefactor code so context pushes up into a single toolbar contextenhancementxComments
-
0 comments Created 6 months ago by durin42Debug toolbar can't doesn't re-hide if set up to show/hide with GET paramsdefectxFor some debugging I've been doing, I've found it useful to configure the debug toolbar to only appear when a GET param is present, but then disappear again when a different GET param is present. This doesn't currently work. Fix in my fork at http://github.com/durin42/django-debug-toolbar/tree/master
Comments
-
0 comments Created 5 months ago by anderserdefectxUnicode Error using ISO-8859-1 as default_charsetverifiedxSeems the rendering of the toolbar crashes when default_charset="iso-8859-1" in settings.py.
----Snipp---------------
Traceback (most recent call last):
File "c:\Python25\Lib\site-packages\django\core\servers\basehttp.py", line 278, in run
self.result = application(self.environ, self.start_response)File "c:\Python25\Lib\site-packages\django\core\servers\basehttp.py", line 635, in call
return self.application(environ, start_response)File "c:\Python25\lib\site-packages\django\core\handlers\wsgi.py", line 245, in call
response = middleware_method(request, response)File "c:\Python25\lib\site-packages\django_debug_toolbar-0.7.0-py2.5.egg\debug_toolbar\middleware.py", line 93, in process_response
response.content = replace_insensitive(smart_unicode(response.content), u'</body>', smart_unicode(self.debug_toolbar.render_toolbar() + u'</body>'))File "c:\Python25\lib\site-packages\django\utils\encoding.py", line 42, in smart_unicode
return force_unicode(s, encoding, strings_only, errors)File "c:\Python25\lib\site-packages\django\utils\encoding.py", line 77, in force_unicode
raise DjangoUnicodeDecodeError(s, *e.args)DjangoUnicodeDecodeError: 'utf8' codec can't decode bytes in position 4432-4434: invalid data. You passed in '\n\n\n\n\n\n<!DOblablablab (my iso-8859-1 encoded page with lots of nordic characters like æøå)
--------end snippet---------
The debug toolbar works if default_charset is set to "utf-8", but that is not an option for me...
Comments
-
0 comments Created 5 months ago by loicenhancementxPass context_instance to the toolbar templatesverifiedxIt would be great if the toolbar templates had access to template context processors.
Passing "context_instance=RequestContext(self.request)" to the render_to_string call in "loader.py - render_toolbar()" does the trick.
It makes it easier for anyone who wants to overload the templates and wants for example to change the location of the toolbar media or change how they are served.
Comments
-
Toolbar ignores INTERNAL_IPS when run with runserver_plus from django-extensions
0 comments Created 4 months ago by qrilkaI use both django-extensions and django-debug-toolbar. I run runserver_plus on my development machine (and thus use werkzeug debugger) and when I access any page on my webserver from the outside I get page with bottom filled with diferent info from debug-toolbar (though toolbar css doesn't work).
Comments
-
Consider using Jannis' package for docs hosted on PyPI:
http://pypi.python.org/pypi/Sphinx-PyPI-upload/Comments
-
0 comments Created 2 months ago by nleushSQL: Show duplicate queries as in SQL Log MiddlewareenhancementxSQL Log Middleware is here: http://www.djangosnippets.org/snippets/344/
Working solution proposition:
Comments
-
I have a manager that takes 'name' and performs the following:
SELECT year as y FROM data_locations WHERE year IS NOT NULL AND name='%(name)s' GROUP BY y ORDER BY y ASCWhen name=niederösterreich I get a UnicodeEncodeError caused by line 108 of panels/sql.py:
'hash': sha_constructor(settings.SECRET_KEY + sql + _params).hexdigest(),
Note, the query works without the debug toolbar installed
Comments
-
0 comments Created 2 months ago by timmolendijk"RuntimeError: request object has expired"defectx[Tue Sep 22 22:04:43 2009] [info] [client 127.0.0.1] mod_wsgi (pid=45241, process='perslijst.smartpr', application=''): Loading WSGI script '/Users/tim/Sites/smartpr/perslijst/parts/smartpr.wsgi.app/wsgi'. [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] mod_wsgi (pid=45241): Exception occurred processing WSGI script '/Users/tim/Sites/smartpr/perslijst/parts/smartpr.wsgi.app/wsgi'. [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] Traceback (most recent call last): [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/core/handlers/wsgi.py", line 243, in __call__ [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] response = middleware_method(request, response) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/Users/tim/Sites/smartpr/perslijst/parts/django-debug-toolbar.pkg/debug_toolbar/middleware.py", line 93, in process_response [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] response.content = replace_insensitive(smart_unicode(response.content), u'</body>', smart_unicode(self.debug_toolbar.render_toolbar() + u'</body>')) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/Users/tim/Sites/smartpr/perslijst/parts/django-debug-toolbar.pkg/debug_toolbar/toolbar/loader.py", line 72, in render_toolbar [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] 'BASE_URL': self.request.META.get('SCRIPT_NAME', ''), [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/loader.py", line 107, in render_to_string [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] return t.render(context_instance) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/test/utils.py", line 15, in instrumented_test_render [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] return self.nodelist.render(context) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/__init__.py", line 768, in render [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] bits.append(self.render_node(node, context)) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/debug.py", line 71, in render_node [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] result = node.render(context) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/defaulttags.py", line 148, in render [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] nodelist.append(node.render(context)) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/defaulttags.py", line 245, in render [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] return self.nodelist_true.render(context) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/__init__.py", line 768, in render [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] bits.append(self.render_node(node, context)) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/debug.py", line 81, in render_node [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] raise wrapped [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] TemplateSyntaxError: Caught an exception while rendering: request object has expired [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] Original Traceback (most recent call last): [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/debug.py", line 71, in render_node [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] result = node.render(context) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/debug.py", line 87, in render [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] output = force_unicode(self.filter_expression.resolve(context)) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/__init__.py", line 535, in resolve [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] obj = self.var.resolve(context) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/__init__.py", line 676, in resolve [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] value = self._resolve_lookup(context) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/template/__init__.py", line 711, in _resolve_lookup [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] current = current() [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/Users/tim/Sites/smartpr/perslijst/parts/django-debug-toolbar.pkg/debug_toolbar/panels/request_vars.py", line 26, in content [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] 'post': [(k, self.request.POST.getlist(k)) for k in self.request.POST.iterkeys()], [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/core/handlers/wsgi.py", line 169, in _get_post [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] self._load_post_and_files() [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/core/handlers/wsgi.py", line 149, in _load_post_and_files [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] self._post, self._files = http.QueryDict(self.raw_post_data, encoding=self._encoding), datastructures.MultiValueDict() [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/core/handlers/wsgi.py", line 203, in _get_raw_post_data [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] size=content_length) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] File "/usr/local/share/buildout/eggs/Django-1.0.2_final-py2.5.egg/django/core/handlers/wsgi.py", line 69, in safe_copyfileobj [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] buf = fsrc.read(min(length, size)) [Tue Sep 22 22:04:44 2009] [error] [client 127.0.0.1] RuntimeError: request object has expiredComments
-
0 comments Created about 1 month ago by olivergeorgeShow modified context for templates invoked with a with clauseenhancementxI'm not seeing "field" in the context displayed for the included template. Not sure if with really modifies the context but it'd be good if this was visible when debugging.
{% with form.fullname as field %} {% include "project/field-snippet.html" %} {% endwith %}Comments
-
3 comments Created about 1 month ago by httpdssAdd an "open with editor" featureenhancementxthis feature focuses on adding an icon beside every file path that is displayed by the debug toolbar and by clicking that icon, the file path opens with your default editor.
Comments
i'll start using the txmt:// uri but this can be extended to support any browser/editor
ref: http://blog.macromates.com/2007/the-textmate-url-scheme/
I've been using a
DEBUG_TOOLBAR_CONFIGsetting to specify a default editor and atemplate_editview to actually open the file in the editor. Of course this only works when run locally. I was using TextMate and the txmt:// URLs but I've since switched to Coda, which doesn't have support for opening files via URL.Xdissent, thx 4 the comment! In the discussion with robhudson today he stated that the solution should be editor independent and the use of settings.py should be avoided too. So stay tuned for coda support ;) the idea is to be able to get the value from $EDITOR but its all under planning stage (except for the txmt links, which i will push into my branch later)
cheers!
-
1 comment Created about 1 month ago by jezdezAdd ability to toggle each panel from the frontendenhancementxI was wondering if it would be a good idea to provide a separate panel that would allow the user to toggle each panel from the frontend. That'd useful e.g. in case the SQL panel takes to long to render and wouldn't require deactivating it site-wide.
Additionally this could be only used on a specific url/path, so that the toggle would survive clicking around the site. That option would be given the user to make in the panel, too.
I guess the toggle state could be saved in a cookie.
Comments
Agreed, this would be a good addition. The user interface for such a thing might be difficult. There have been times, with large Django installations, that I've had to disable most panels to get a reasonable time to render the response (due to the (a) extra introspection the debug toolbar has to do, (b) the extra template rendering, and (c) the extra HTML rendering by the browser).
I think saving state is best done in the cookie, similar to how we're saving the minimized state there already.
-
In case someone else wants this and has time before I do:
It'd be really awesome if we collapsed the contents of the context display panel for either huge elements or simply the common boilerplate like context['request']. It seems like this would require manually serializing the context objects so they could be styled - maybe it'd be worth switching entirely to nested
- s, with a jQuery toggle on click?
Comments
Naturally, I posted this just seconds before noticing 1ca31fe. I still think it'd be better to have that information available in some cases but this takes away most of my motivation.
We've replaced both the sql_queries context (if the debug context process in enabled), and the request context with representations, since both of these can be seen in the other panels. This change was added and is now in the 0.8.1 release.
See:
http://github.com/robhudson/django-debug-toolbar/commit/1ca31fe54936d29f15cf23d92b9ab331e5199707Huge elements are a different matter. I wouldn't want to truncate them. But increasing the usability of reading them I agree would be worthwhile.
-
0 comments Created 18 days ago by raphjikProposal (with patch): new Tidy panelenhancementxA new panel which displays tidy html errors and warning on current page
(requires python-utidylib but degrades nicely if the library is not available on python system path)
git patch against current master : http://bit.ly/4pVmAW
Comments
-
The request context vars set by the template tag aren't seen
0 comments Created 2 days ago by arthur78I have a template tag which adds to the context some additional variables. When I go to the Templates panel and click Toggle Context, those new variables are not listed.
(debug_toolbar-0.7.0-py2.5)
Comments











