id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 1788 sometimes tecnhical_500_response fails anonymous Adrian Holovaty "In django.views.debug.py the following code fails: {{{ pre_context_lineno, pre_context, context_line, post_context = _get_lines_from_file(filename, lineno, 7) frames.append({ 'tb': tb, 'filename': filename, 'function': function, 'lineno': lineno + 1, 'vars': tb.tb_frame.f_locals.items(), 'id': id(tb), 'pre_context': pre_context, 'context_line': context_line, 'post_context': post_context, 'pre_context_lineno': pre_context_lineno + 1, }) }}} It fails on 'pre_context_lineno + 1' in case pre_context_lineno is None (cannot apply '+' to None and 1). This happens when django can't find the source file where the error occurred. To reproduce: 1. In a view, import some module from a directory in your PYTHONPATH, other than the path to django, and directory from which web server starts. 2. Call some method in this module, which raises an exception. Django will not find the source, and produce a backtrace like this: {{{ Traceback (most recent call last): File ""/home/valeriyz/django/django/core/servers/basehttp.py"", line 272, in run self.result = application(self.environ, self.start_response) File ""/home/valeriyz/django/django/core/servers/basehttp.py"", line 615, in __call__ return self.application(environ, start_response) File ""/home/valeriyz/django/django/core/handlers/wsgi.py"", line 145, in __call__ response = self.get_response(request.path, request) File ""/home/valeriyz/django/django/core/handlers/base.py"", line 100, in get_response return self.get_technical_error_response(request) File ""/home/valeriyz/django/django/core/handlers/base.py"", line 133, in get_technical_error_response return debug.technical_500_response(request, *sys.exc_info()) File ""/home/valeriyz/django/django/views/debug.py"", line 99, in technical_500_response frames.append({ TypeError: unsupported operand type(s) for +: 'NoneType' and 'int' }}} " defect closed Core (Other) normal fixed Unreviewed 0 0 0 0 0 0