Originally based on: [http://djangosnippets.org/snippets/1872/](http://djangosnippets.org/snippets/1872/)
The way the original snippet formatted sql didn't work for mysql properly so I taught it to use the sqlparse python module. Now it looks like this when settings.DEBUG=True:
SQL executed:
SELECT "django_session"."session_key",
"django_session"."session_data",
"django_session"."expire_date"
FROM "django_session"
WHERE ("django_session"."session_key" = d326108d313a2e5c5fb417364b005ab9
AND "django_session"."expire_date" > 2011-04-08 14:54:13.969881)
took 0.001 seconds
SELECT "auth_user"."id",
"auth_user"."username",
"auth_user"."first_name",
"auth_user"."last_name",
"auth_user"."email",
"auth_user"."password",
"auth_user"."is_staff",
"auth_user"."is_active",
"auth_user"."is_superuser",
"auth_user"."last_login",
"auth_user"."date_joined"
FROM "auth_user"
WHERE "auth_user"."id" = 2
took 0.000 seconds
Additionally, this middlware is enabled conditionally based upon the url query string "debug". You can enable it for a single request by appending: ?debug=true to the url.
- middleware
- development
- debug
ReportBug() allows you to send exception details to you, via email, but with
far more detail than the default. It uses the base function for the traceback
used by the Debug mode on Django.
This is a first revision, so the emails have no decent styling, but it works,
and shows scope on each stack.
It will automatically generate a random serial number per error, so you can track them
in your favourite bug tracker. It also has support for you to pass it a request variable,
so the mail would also contain request/response context. Again, i'm gonna look into doing
this manually in the future.
Hope this helps!
Mwah.
Cal Leeming.
cal [at] simplicitymedialtd.co.uk.
Simplicity Media Ltd.
- email
- debug
- mail
- exception
- report
- bug
- mail_admins
- reportbug