Our team has been using Django for about one year. I find it difficult to debug with Django despite the attempt at friendly traceback pages. It seems Django has failed to take advantage of the tracebacks that are available.
First off near line 97 of django/views/debug.py if pre_context_lineno: this test fails constantly because DJango seems to have the wrong path names for most modules. It seems Django ends up with pathnames like ./core/handlers/base.py rather than django/core/handlers/base.py The result of this failure is that the stack traces have missing frames and often the actual error frame is missing. A simple patch to fix this silliness Index: django/views/debug.py =================================================================== --- django/views/debug.py (revision 4207) +++ django/views/debug.py (working copy) @@ -107,6 +107,20 @@ 'post_context': post_context, 'pre_context_lineno': pre_context_lineno + 1, }) + else: + frames.append({ + 'tb': tb, + 'filename': filename, + 'function': function, + 'lineno': lineno + 1, + 'vars': tb.tb_frame.f_locals.items(), + 'id': id(tb), + 'pre_context': '[unknown pre_context]', + 'context_line': '[unknown context_line]', + 'post_context': '[unknown post_context]', + 'pre_context_lineno': '[unknown pre_context_lineno]', + }) + tb = tb.tb_next if not frames: Secondly it seems that bugs in middleware are uncaught eg in core.handlers.base.BaseHandler.get_response django/core/handlers/base.py line 58 # Apply request middleware for middleware_method in self._request_middleware: response = middleware_method(request) if response: return response is not in the main try block so is not handled properly. Also the post processing of responses is broken eg in django/core/handlers/modpython.py near line 150 # Apply response middleware for middleware_method in self._response_middleware: response = middleware_method(request, response) is outside of any try except block so cannot have a nice traceback. A colleague is trying to use a middleware for logging successes and errors. However, it seems that using process_exception only sees errors in the main callback and not any other middleware methods. Again this seems to be caused by the code in BaseHandler.get_response. Surely any error in middleware is as damaging as an error in the main callback? -- Robin Becker --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---