#13958: There is an error, when a source file with backslash-r returns is interpreted by the Python error report page. --------------------------------------+------------------------------------- Reporter: petrvanblokland | Owner: nobody Status: new | Milestone: Component: Uncategorized | Version: 1.2 Resolution: | Keywords: Stage: Unreviewed | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | --------------------------------------+------------------------------------- Old description:
> There is an error, when a source file with backslash-r returns is > interpreted by the Python error report page. > > Due to a hard split on backslah-n, the lineno is out of range. > Also it is not clear what the name of the file is where this goes wrong. > Adding source = source.replace('\r', '\n') solves the problem, but maybe > not structural enough. > > Kind regards, > Petr van Blokland > b...@petr.com > > > Traceback (most recent call last): > > File "/Library/Python/2.5/site- > packages/django/core/servers/basehttp.py", line 279, in run > self.result = application(self.environ, self.start_response) > > File "/Library/Python/2.5/site- > packages/django/core/servers/basehttp.py", line 651, in __call__ > return self.application(environ, start_response) > > File "/Library/Python/2.5/site-packages/django/core/handlers/wsgi.py", > line 241, in __call__ > response = self.get_response(request) > > File "/Library/Python/2.5/site-packages/django/core/handlers/base.py", > line 137, in get_response > return self.handle_uncaught_exception(request, resolver, exc_info) > > File "/Library/Python/2.5/site-packages/django/core/handlers/base.py", > line 157, in handle_uncaught_exception > return debug.technical_500_response(request, *exc_info) > > File "/Library/Python/2.5/site-packages/django/views/debug.py", line > 58, in technical_500_response > html = reporter.get_traceback_html() > > File "/Library/Python/2.5/site-packages/django/views/debug.py", line > 109, in get_traceback_html > frames = self.get_traceback_frames() > > File "/Library/Python/2.5/site-packages/django/views/debug.py", line > 228, in get_traceback_frames > pre_context_lineno, pre_context, context_line, post_context = > self._get_lines_from_file(filename, lineno, 7, loader, module_name) > > File "/Library/Python/2.5/site-packages/django/views/debug.py", line > 209, in _get_lines_from_file > context_line = source[lineno].strip('\n') > > IndexError: list index out of range New description: There is an error, when a source file with backslash-r returns is interpreted by the Python error report page. Due to a hard split on backslah-n, the lineno is out of range. Also it is not clear what the name of the file is where this goes wrong. Adding source = source.replace('\r', '\n') solves the problem, but maybe not structural enough. Kind regards, Petr van Blokland b...@petr.com {{{ Traceback (most recent call last): File "/Library/Python/2.5/site- packages/django/core/servers/basehttp.py", line 279, in run self.result = application(self.environ, self.start_response) File "/Library/Python/2.5/site- packages/django/core/servers/basehttp.py", line 651, in __call__ return self.application(environ, start_response) File "/Library/Python/2.5/site-packages/django/core/handlers/wsgi.py", line 241, in __call__ response = self.get_response(request) File "/Library/Python/2.5/site-packages/django/core/handlers/base.py", line 137, in get_response return self.handle_uncaught_exception(request, resolver, exc_info) File "/Library/Python/2.5/site-packages/django/core/handlers/base.py", line 157, in handle_uncaught_exception return debug.technical_500_response(request, *exc_info) File "/Library/Python/2.5/site-packages/django/views/debug.py", line 58, in technical_500_response html = reporter.get_traceback_html() File "/Library/Python/2.5/site-packages/django/views/debug.py", line 109, in get_traceback_html frames = self.get_traceback_frames() File "/Library/Python/2.5/site-packages/django/views/debug.py", line 228, in get_traceback_frames pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name) File "/Library/Python/2.5/site-packages/django/views/debug.py", line 209, in _get_lines_from_file context_line = source[lineno].strip('\n') IndexError: list index out of range }}} Comment (by kmtracey): Fixed formatting. Please use WikiFormatting and the preview button before submitting. -- Ticket URL: <http://code.djangoproject.com/ticket/13958#comment:1> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.